Skip to content

Commit

Permalink
group imports with rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-1 committed Oct 26, 2024
1 parent b762575 commit 6b0fe5b
Show file tree
Hide file tree
Showing 128 changed files with 469 additions and 357 deletions.
10 changes: 6 additions & 4 deletions azalea-auth/src/auth.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
//! Handle Minecraft (Xbox) authentication.
use crate::cache::{self, CachedAccount, ExpiringValue};
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use serde_json::json;
use std::{
collections::HashMap,
path::PathBuf,
time::{Instant, SystemTime, UNIX_EPOCH},
};

use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use serde_json::json;
use thiserror::Error;
use tracing::{error, trace};
use uuid::Uuid;

use crate::cache::{self, CachedAccount, ExpiringValue};

#[derive(Default)]
pub struct AuthOpts<'a> {
/// Whether we should check if the user actually owns the game. This will
Expand Down
3 changes: 2 additions & 1 deletion azalea-auth/src/cache.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//! Cache auth information
use serde::{Deserialize, Serialize};
use std::path::Path;
use std::time::{SystemTime, UNIX_EPOCH};

use serde::{Deserialize, Serialize};
use thiserror::Error;
use tokio::fs::File;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
Expand Down
3 changes: 2 additions & 1 deletion azalea-auth/src/game_profile.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::HashMap;

use azalea_buf::McBuf;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use uuid::Uuid;

#[derive(McBuf, Debug, Clone, Default, Eq, PartialEq)]
Expand Down
5 changes: 3 additions & 2 deletions azalea-block/azalea-block-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
mod utils;

use std::collections::HashMap;
use std::fmt::Write;

use proc_macro::TokenStream;
use proc_macro2::TokenTree;
use quote::quote;
use std::collections::HashMap;
use std::fmt::Write;
use syn::{
braced,
ext::IdentExt,
Expand Down
6 changes: 4 additions & 2 deletions azalea-block/src/generated.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use crate::{Block, BlockBehavior, BlockState, BlockStates, Property};
use azalea_block_macros::make_block_states;
use std::fmt::Debug;

use azalea_block_macros::make_block_states;

use crate::{Block, BlockBehavior, BlockState, BlockStates, Property};

make_block_states! {
Properties => {
"snowy" => Snowy(bool),
Expand Down
10 changes: 5 additions & 5 deletions azalea-block/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ mod behavior;
mod generated;
mod range;

pub use generated::{blocks, properties};

use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
pub use behavior::BlockBehavior;
use core::fmt::Debug;
pub use range::BlockStates;
use std::{
any::Any,
io::{Cursor, Write},
};

use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
pub use behavior::BlockBehavior;
pub use generated::{blocks, properties};
pub use range::BlockStates;

pub trait Block: Debug + Any {
fn behavior(&self) -> BlockBehavior;
/// Get the Minecraft ID for this block. For example `stone` or
Expand Down
3 changes: 1 addition & 2 deletions azalea-brigadier/src/arguments/bool_argument_type.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use std::{any::Any, sync::Arc};

use super::ArgumentType;
use crate::{
context::CommandContext,
exceptions::CommandSyntaxException,
string_reader::StringReader,
suggestion::{Suggestions, SuggestionsBuilder},
};

use super::ArgumentType;

#[derive(Default)]
struct Boolean;

Expand Down
3 changes: 1 addition & 2 deletions azalea-brigadier/src/arguments/double_argument_type.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use std::{any::Any, sync::Arc};

use super::ArgumentType;
use crate::{
context::CommandContext,
exceptions::{BuiltInExceptions, CommandSyntaxException},
string_reader::StringReader,
};

use super::ArgumentType;

#[derive(Default)]
struct Double {
pub minimum: Option<f64>,
Expand Down
3 changes: 1 addition & 2 deletions azalea-brigadier/src/arguments/float_argument_type.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use std::{any::Any, sync::Arc};

use super::ArgumentType;
use crate::{
context::CommandContext,
exceptions::{BuiltInExceptions, CommandSyntaxException},
string_reader::StringReader,
};

use super::ArgumentType;

#[derive(Default)]
struct Float {
pub minimum: Option<f32>,
Expand Down
3 changes: 1 addition & 2 deletions azalea-brigadier/src/arguments/integer_argument_type.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use std::{any::Any, sync::Arc};

use super::ArgumentType;
use crate::{
context::CommandContext,
exceptions::{BuiltInExceptions, CommandSyntaxException},
string_reader::StringReader,
};

use super::ArgumentType;

#[derive(Default)]
struct Integer {
pub minimum: Option<i32>,
Expand Down
3 changes: 1 addition & 2 deletions azalea-brigadier/src/arguments/long_argument_type.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use std::{any::Any, sync::Arc};

use super::ArgumentType;
use crate::{
context::CommandContext,
exceptions::{BuiltInExceptions, CommandSyntaxException},
string_reader::StringReader,
};

use super::ArgumentType;

#[derive(Default)]
struct Long {
pub minimum: Option<i64>,
Expand Down
3 changes: 1 addition & 2 deletions azalea-brigadier/src/arguments/string_argument_type.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use std::{any::Any, sync::Arc};

use super::ArgumentType;
use crate::{
context::CommandContext, exceptions::CommandSyntaxException, string_reader::StringReader,
};

use super::ArgumentType;

pub enum StringArgument {
/// Match up until the next space.
SingleWord,
Expand Down
6 changes: 3 additions & 3 deletions azalea-brigadier/src/builder/argument_builder.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use std::{fmt::Debug, sync::Arc};

use parking_lot::RwLock;

use super::{literal_argument_builder::Literal, required_argument_builder::Argument};
use crate::{
context::CommandContext,
modifier::RedirectModifier,
tree::{Command, CommandNode},
};

use super::{literal_argument_builder::Literal, required_argument_builder::Argument};
use std::{fmt::Debug, sync::Arc};

#[derive(Debug, Clone)]
pub enum ArgumentBuilderType {
Literal(Literal),
Expand Down
3 changes: 2 additions & 1 deletion azalea-brigadier/src/builder/required_argument_builder.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use std::{any::Any, fmt::Debug, sync::Arc};

use super::argument_builder::{ArgumentBuilder, ArgumentBuilderType};
use crate::{
arguments::ArgumentType,
exceptions::CommandSyntaxException,
string_reader::StringReader,
suggestion::{Suggestions, SuggestionsBuilder},
};
use std::{any::Any, fmt::Debug, sync::Arc};

/// An argument node type. The `T` type parameter is the type of the argument,
/// which can be anything.
Expand Down
15 changes: 8 additions & 7 deletions azalea-brigadier/src/command_dispatcher.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
use std::{
cmp::Ordering,
collections::{HashMap, HashSet},
mem,
rc::Rc,
sync::Arc,
};

use parking_lot::RwLock;

use crate::{
Expand All @@ -9,13 +17,6 @@ use crate::{
suggestion::{Suggestions, SuggestionsBuilder},
tree::CommandNode,
};
use std::{
cmp::Ordering,
collections::{HashMap, HashSet},
mem,
rc::Rc,
sync::Arc,
};

/// The root of the command tree. You need to make this to register commands.
///
Expand Down
3 changes: 2 additions & 1 deletion azalea-brigadier/src/context/command_context.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use std::{any::Any, collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};

use parking_lot::RwLock;

use super::{parsed_command_node::ParsedCommandNode, string_range::StringRange, ParsedArgument};
use crate::{
modifier::RedirectModifier,
tree::{Command, CommandNode},
};
use std::{any::Any, collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};

/// A built `CommandContextBuilder`.
pub struct CommandContext<S> {
Expand Down
3 changes: 2 additions & 1 deletion azalea-brigadier/src/context/command_context_builder.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::{collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};

use parking_lot::RwLock;

use super::{
Expand All @@ -9,7 +11,6 @@ use crate::{
modifier::RedirectModifier,
tree::{Command, CommandNode},
};
use std::{collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};

pub struct CommandContextBuilder<'a, S> {
pub arguments: HashMap<String, ParsedArgument>,
Expand Down
3 changes: 2 additions & 1 deletion azalea-brigadier/src/context/parsed_argument.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::string_range::StringRange;
use std::{any::Any, sync::Arc};

use super::string_range::StringRange;

#[derive(Clone)]
pub struct ParsedArgument {
pub range: StringRange,
Expand Down
3 changes: 2 additions & 1 deletion azalea-brigadier/src/context/parsed_command_node.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use std::sync::Arc;

use parking_lot::RwLock;

use super::string_range::StringRange;
use crate::tree::CommandNode;
use std::sync::Arc;

#[derive(Debug)]
pub struct ParsedCommandNode<S> {
Expand Down
3 changes: 1 addition & 2 deletions azalea-brigadier/src/exceptions/builtin_exceptions.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::fmt;

use crate::string_reader::StringReader;

use super::command_syntax_exception::CommandSyntaxException;
use crate::string_reader::StringReader;

#[derive(Clone, PartialEq)]
pub enum BuiltInExceptions {
Expand Down
3 changes: 2 additions & 1 deletion azalea-brigadier/src/exceptions/command_syntax_exception.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use super::builtin_exceptions::BuiltInExceptions;
use std::{
cmp,
fmt::{self, Write},
};

use super::builtin_exceptions::BuiltInExceptions;

#[derive(Clone, PartialEq)]
pub struct CommandSyntaxException {
pub type_: BuiltInExceptions,
Expand Down
3 changes: 2 additions & 1 deletion azalea-brigadier/src/parse_results.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use std::{collections::HashMap, fmt::Debug, rc::Rc};

use crate::{
context::CommandContextBuilder, exceptions::CommandSyntaxException,
string_reader::StringReader, tree::CommandNode,
};
use std::{collections::HashMap, fmt::Debug, rc::Rc};

pub struct ParseResults<'a, S> {
pub context: CommandContextBuilder<'a, S>,
Expand Down
3 changes: 2 additions & 1 deletion azalea-brigadier/src/string_reader.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::exceptions::{BuiltInExceptions, CommandSyntaxException};
use std::str::FromStr;

use crate::exceptions::{BuiltInExceptions, CommandSyntaxException};

#[derive(Clone)]
pub struct StringReader {
string: String,
Expand Down
12 changes: 7 additions & 5 deletions azalea-brigadier/src/suggestion/mod.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
mod suggestions;
mod suggestions_builder;

use crate::context::StringRange;
#[cfg(feature = "azalea-buf")]
use azalea_buf::McBufWritable;
#[cfg(feature = "azalea-buf")]
use azalea_chat::FormattedText;
#[cfg(feature = "azalea-buf")]
use std::io::Write;
use std::{
fmt::{self, Display},
hash::Hash,
};

#[cfg(feature = "azalea-buf")]
use azalea_buf::McBufWritable;
#[cfg(feature = "azalea-buf")]
use azalea_chat::FormattedText;
pub use suggestions::Suggestions;
pub use suggestions_builder::SuggestionsBuilder;

use crate::context::StringRange;

/// A suggestion given to the user for what they might want to type next.
///
/// The `M` generic is the type of the tooltip, so for example a `String` or
Expand Down
12 changes: 7 additions & 5 deletions azalea-brigadier/src/suggestion/suggestions.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
use super::Suggestion;
use crate::context::StringRange;
#[cfg(feature = "azalea-buf")]
use crate::suggestion::SuggestionValue;
use std::io::{Cursor, Write};
use std::{collections::HashSet, hash::Hash};

#[cfg(feature = "azalea-buf")]
use azalea_buf::{
BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable,
};
#[cfg(feature = "azalea-buf")]
use azalea_chat::FormattedText;

use super::Suggestion;
use crate::context::StringRange;
#[cfg(feature = "azalea-buf")]
use std::io::{Cursor, Write};
use std::{collections::HashSet, hash::Hash};
use crate::suggestion::SuggestionValue;

#[derive(Debug, Clone, Eq, PartialEq, Hash, Default)]
pub struct Suggestions {
Expand Down
3 changes: 1 addition & 2 deletions azalea-brigadier/src/suggestion/suggestions_builder.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::collections::HashSet;

use crate::context::StringRange;

use super::{Suggestion, SuggestionValue, Suggestions};
use crate::context::StringRange;

#[derive(PartialEq, Debug)]
pub struct SuggestionsBuilder {
Expand Down
Loading

0 comments on commit 6b0fe5b

Please sign in to comment.