mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
clippy
This commit is contained in:
parent
9ee5e71bb1
commit
c652bbc609
9 changed files with 14 additions and 22 deletions
|
@ -257,8 +257,7 @@ async fn interactive_get_ms_auth_token(
|
||||||
log::trace!("Polling to check if user has logged in...");
|
log::trace!("Polling to check if user has logged in...");
|
||||||
if let Ok(access_token_response) = client
|
if let Ok(access_token_response) = client
|
||||||
.post(format!(
|
.post(format!(
|
||||||
"https://login.live.com/oauth20_token.srf?client_id={}",
|
"https://login.live.com/oauth20_token.srf?client_id={CLIENT_ID}"
|
||||||
CLIENT_ID
|
|
||||||
))
|
))
|
||||||
.form(&vec![
|
.form(&vec![
|
||||||
("client_id", CLIENT_ID),
|
("client_id", CLIENT_ID),
|
||||||
|
|
|
@ -83,17 +83,12 @@ impl fmt::Debug for BuiltInExceptions {
|
||||||
write!(f, "Unclosed quoted string")
|
write!(f, "Unclosed quoted string")
|
||||||
}
|
}
|
||||||
BuiltInExceptions::ReaderInvalidEscape { character } => {
|
BuiltInExceptions::ReaderInvalidEscape { character } => {
|
||||||
write!(
|
write!(f, "Invalid escape sequence '{character}' in quoted string")
|
||||||
f,
|
|
||||||
"Invalid escape sequence '{}' in quoted string",
|
|
||||||
character
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
BuiltInExceptions::ReaderInvalidBool { value } => {
|
BuiltInExceptions::ReaderInvalidBool { value } => {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"Invalid bool, expected true or false but found '{}'",
|
"Invalid bool, expected true or false but found '{value}'",
|
||||||
value
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
BuiltInExceptions::ReaderInvalidInt { value } => {
|
BuiltInExceptions::ReaderInvalidInt { value } => {
|
||||||
|
|
|
@ -69,7 +69,7 @@ pub fn create_impl_mcbufreadable(ident: &Ident, data: &Data) -> proc_macro2::Tok
|
||||||
variant_discrim = match &d.1 {
|
variant_discrim = match &d.1 {
|
||||||
syn::Expr::Lit(e) => match &e.lit {
|
syn::Expr::Lit(e) => match &e.lit {
|
||||||
syn::Lit::Int(i) => i.base10_parse().unwrap(),
|
syn::Lit::Int(i) => i.base10_parse().unwrap(),
|
||||||
_ => panic!("Error parsing enum discriminant as int (is {:?})", e),
|
_ => panic!("Error parsing enum discriminant as int (is {e:?})",),
|
||||||
},
|
},
|
||||||
syn::Expr::Unary(_) => {
|
syn::Expr::Unary(_) => {
|
||||||
panic!("Negative enum discriminants are not supported")
|
panic!("Negative enum discriminants are not supported")
|
||||||
|
|
|
@ -71,7 +71,7 @@ pub fn create_impl_mcbufwritable(ident: &Ident, data: &Data) -> proc_macro2::Tok
|
||||||
syn::Expr::Lit(e) => match &e.lit {
|
syn::Expr::Lit(e) => match &e.lit {
|
||||||
syn::Lit::Int(i) => i.base10_parse().unwrap(),
|
syn::Lit::Int(i) => i.base10_parse().unwrap(),
|
||||||
// syn::Lit::Str(s) => s.value(),
|
// syn::Lit::Str(s) => s.value(),
|
||||||
_ => panic!("Error parsing enum discriminant as int (is {:?})", e),
|
_ => panic!("Error parsing enum discriminant as int (is {e:?})"),
|
||||||
},
|
},
|
||||||
syn::Expr::Unary(_) => {
|
syn::Expr::Unary(_) => {
|
||||||
panic!("Negative enum discriminants are not supported")
|
panic!("Negative enum discriminants are not supported")
|
||||||
|
|
|
@ -74,7 +74,8 @@ impl ChatPacket {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the UUID of the sender of the message. If it's not a
|
/// Get the UUID of the sender of the message. If it's not a
|
||||||
/// player-sent chat message, this will be None.
|
/// player-sent chat message, this will be None (this is sometimes the case
|
||||||
|
/// when a server uses a plugin to modify chat messages).
|
||||||
pub fn uuid(&self) -> Option<Uuid> {
|
pub fn uuid(&self) -> Option<Uuid> {
|
||||||
match self {
|
match self {
|
||||||
ChatPacket::System(_) => None,
|
ChatPacket::System(_) => None,
|
||||||
|
|
|
@ -25,9 +25,7 @@ impl BitSet {
|
||||||
fn check_range(&self, from_index: usize, to_index: usize) {
|
fn check_range(&self, from_index: usize, to_index: usize) {
|
||||||
assert!(
|
assert!(
|
||||||
from_index <= to_index,
|
from_index <= to_index,
|
||||||
"fromIndex: {} > toIndex: {}",
|
"fromIndex: {from_index} > toIndex: {to_index}",
|
||||||
from_index,
|
|
||||||
to_index
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,8 +91,7 @@ impl fmt::Display for BitStorageError {
|
||||||
match self {
|
match self {
|
||||||
BitStorageError::InvalidLength { got, expected } => write!(
|
BitStorageError::InvalidLength { got, expected } => write!(
|
||||||
f,
|
f,
|
||||||
"Invalid length given for storage, got: {}, but expected: {}",
|
"Invalid length given for storage, got: {got}, but expected: {expected}",
|
||||||
got, expected
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ impl Trait for azalea_client::Client {
|
||||||
for possible_move in possible_moves.iter() {
|
for possible_move in possible_moves.iter() {
|
||||||
edges.push(Edge {
|
edges.push(Edge {
|
||||||
target: possible_move.next_node(node),
|
target: possible_move.next_node(node),
|
||||||
cost: possible_move.cost(&world, node),
|
cost: possible_move.cost(world, node),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
edges
|
edges
|
||||||
|
|
|
@ -43,7 +43,7 @@ async fn main() -> anyhow::Result<()> {
|
||||||
let mut states = Vec::new();
|
let mut states = Vec::new();
|
||||||
|
|
||||||
for i in 0..1 {
|
for i in 0..1 {
|
||||||
accounts.push(Account::offline(&format!("bot{}", i)));
|
accounts.push(Account::offline(&format!("bot{i}")));
|
||||||
states.push(State::default());
|
states.push(State::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ async fn handle(mut bot: Client, event: Event, _state: State) -> anyhow::Result<
|
||||||
} else if m.content() == "look" {
|
} else if m.content() == "look" {
|
||||||
let target_pos_vec3 = entity.pos();
|
let target_pos_vec3 = entity.pos();
|
||||||
let target_pos: BlockPos = target_pos_vec3.into();
|
let target_pos: BlockPos = target_pos_vec3.into();
|
||||||
println!("target_pos: {:?}", target_pos);
|
println!("target_pos: {target_pos:?}");
|
||||||
bot.look_at(&target_pos.center());
|
bot.look_at(&target_pos.center());
|
||||||
} else if m.content() == "jump" {
|
} else if m.content() == "jump" {
|
||||||
bot.set_jumping(true);
|
bot.set_jumping(true);
|
||||||
|
@ -138,10 +138,10 @@ async fn swarm_handle(
|
||||||
println!("swarm chat message: {}", m.message().to_ansi());
|
println!("swarm chat message: {}", m.message().to_ansi());
|
||||||
if m.message().to_string() == "<py5> world" {
|
if m.message().to_string() == "<py5> world" {
|
||||||
for (name, world) in &swarm.worlds.read().worlds {
|
for (name, world) in &swarm.worlds.read().worlds {
|
||||||
println!("world name: {}", name);
|
println!("world name: {name}");
|
||||||
if let Some(w) = world.upgrade() {
|
if let Some(w) = world.upgrade() {
|
||||||
for chunk_pos in w.chunk_storage.read().chunks.values() {
|
for chunk_pos in w.chunk_storage.read().chunks.values() {
|
||||||
println!("chunk: {:?}", chunk_pos);
|
println!("chunk: {chunk_pos:?}");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
println!("nvm world is gone");
|
println!("nvm world is gone");
|
||||||
|
|
Loading…
Add table
Reference in a new issue