Change rustfmt settings

This commit is contained in:
Ryan 2022-08-28 21:31:07 -07:00
parent c503e6eb78
commit 2a266fb091
15 changed files with 46 additions and 47 deletions

View file

@ -55,12 +55,12 @@ const SPAWN_POS: BlockPos = BlockPos::new(0, 20, 0);
#[async_trait]
impl Config for Game {
type ChunkState = ();
type ServerState = Option<PlayerListId>;
type ClientState = ClientState;
type EntityState = EntityState;
type PlayerListState = ();
type ServerState = Option<PlayerListId>;
type WorldState = ();
type ChunkState = ();
type PlayerListState = ();
fn max_connections(&self) -> usize {
// We want status pings to be successful even if the server is full.

View file

@ -53,12 +53,12 @@ const BOARD_Y: i32 = 50;
#[async_trait]
impl Config for Game {
type ChunkState = ();
type ServerState = ServerState;
type ClientState = EntityId;
type EntityState = ();
type PlayerListState = ();
type ServerState = ServerState;
type WorldState = ();
type ChunkState = ();
type PlayerListState = ();
fn max_connections(&self) -> usize {
// We want status pings to be successful even if the server is full.

View file

@ -48,12 +48,12 @@ const SPAWN_POS: BlockPos = BlockPos::new(0, 100, -25);
#[async_trait]
impl Config for Game {
type ChunkState = ();
type ServerState = ServerState;
type ClientState = EntityId;
type EntityState = ();
type PlayerListState = ();
type ServerState = ServerState;
type WorldState = ();
type ChunkState = ();
type PlayerListState = ();
fn max_connections(&self) -> usize {
// We want status pings to be successful even if the server is full.

View file

@ -42,13 +42,13 @@ const PLAYER_EYE_HEIGHT: f64 = 1.6;
#[async_trait]
impl Config for Game {
type ChunkState = ();
type ServerState = Option<PlayerListId>;
type ClientState = EntityId;
/// `true` for entities that have been intersected with.
type EntityState = bool;
type PlayerListState = ();
type ServerState = Option<PlayerListId>;
type WorldState = ();
type ChunkState = ();
type PlayerListState = ();
fn max_connections(&self) -> usize {
// We want status pings to be successful even if the server is full.

View file

@ -52,13 +52,13 @@ const MAX_PLAYERS: usize = 10;
#[async_trait]
impl Config for Game {
/// If the chunk should stay loaded at the end of the tick.
type ChunkState = bool;
type ServerState = Option<PlayerListId>;
type ClientState = EntityId;
type EntityState = ();
type PlayerListState = ();
type ServerState = Option<PlayerListId>;
type WorldState = ();
/// If the chunk should stay loaded at the end of the tick.
type ChunkState = bool;
type PlayerListState = ();
fn max_connections(&self) -> usize {
// We want status pings to be successful even if the server is full.

View file

@ -2,7 +2,6 @@ edition = "2021"
unstable_features = true
wrap_comments = true
imports_granularity = "Module"
reorder_impl_items = true
group_imports = "StdExternalCrate"
format_code_in_doc_comments = true
format_macro_matchers = true

View file

@ -58,11 +58,11 @@
//! struct Game;
//!
//! impl Config for Game {
//! type ChunkState = ();
//! type ServerState = ();
//! type ClientState = ();
//! type EntityState = ();
//! type ServerState = ();
//! type WorldState = ();
//! type ChunkState = ();
//!
//! fn max_connections(&self) -> usize {
//! 256
@ -128,7 +128,7 @@ pub use async_trait::async_trait;
#[doc(inline)]
pub use server::start_server;
#[doc(inline)]
pub use {nbt, uuid, vek};
pub use {uuid, vek};
pub mod biome;
pub mod block;

View file

@ -96,7 +96,7 @@ mod tests {
{
buf.clear();
n.encode(&mut buf).unwrap();
assert!(buf.len() == n.written_size());
assert_eq!(buf.len(), n.written_size());
}
}

View file

@ -149,8 +149,8 @@ impl<T> Slab<T> {
}
impl<'a, T> IntoIterator for &'a Slab<T> {
type IntoIter = Iter<'a, T>;
type Item = (usize, &'a T);
type IntoIter = Iter<'a, T>;
fn into_iter(self) -> Self::IntoIter {
self.iter()
@ -158,8 +158,8 @@ impl<'a, T> IntoIterator for &'a Slab<T> {
}
impl<'a, T> IntoIterator for &'a mut Slab<T> {
type IntoIter = IterMut<'a, T>;
type Item = (usize, &'a mut T);
type IntoIter = IterMut<'a, T>;
fn into_iter(self) -> Self::IntoIter {
self.iter_mut()
@ -167,8 +167,8 @@ impl<'a, T> IntoIterator for &'a mut Slab<T> {
}
impl<'a, T: Sync> IntoParallelIterator for &'a Slab<T> {
type Item = (usize, &'a T);
type Iter = ParIter<'a, T>;
type Item = (usize, &'a T);
fn into_par_iter(self) -> Self::Iter {
ParIter { slab: self }
@ -176,8 +176,8 @@ impl<'a, T: Sync> IntoParallelIterator for &'a Slab<T> {
}
impl<'a, T: Send + Sync> IntoParallelIterator for &'a mut Slab<T> {
type Item = (usize, &'a mut T);
type Iter = ParIterMut<'a, T>;
type Item = (usize, &'a mut T);
fn into_par_iter(self) -> Self::Iter {
ParIterMut { slab: self }

View file

@ -13,8 +13,8 @@ pub struct SerializeMap<'w, W: ?Sized> {
}
impl<'w, W: Write + ?Sized> ser::SerializeMap for SerializeMap<'w, W> {
type Error = Error;
type Ok = ();
type Error = Error;
fn serialize_key<T: ?Sized>(&mut self, _key: &T) -> Result<(), Error>
where
@ -62,15 +62,15 @@ fn key_not_a_string<T>(typ: &str) -> Result<T, Error> {
}
impl<W: Write + ?Sized, V: Serialize + ?Sized> Serializer for MapEntrySerializer<'_, '_, W, V> {
type Error = Error;
type Ok = ();
type SerializeMap = Impossible;
type Error = Error;
type SerializeSeq = Impossible;
type SerializeStruct = Impossible;
type SerializeStructVariant = Impossible;
type SerializeTuple = Impossible;
type SerializeTupleStruct = Impossible;
type SerializeTupleVariant = Impossible;
type SerializeMap = Impossible;
type SerializeStruct = Impossible;
type SerializeStructVariant = Impossible;
fn serialize_bool(self, _v: bool) -> Result<Self::Ok, Self::Error> {
key_not_a_string("bool")

View file

@ -99,15 +99,15 @@ fn unsupported<T>(typ: &str) -> Result<T, Error> {
}
impl<'a, W: Write + ?Sized> Serializer for &'a mut PayloadSerializer<'_, '_, W> {
type Error = Error;
type Ok = ();
type SerializeMap = SerializeMap<'a, W>;
type Error = Error;
type SerializeSeq = SerializeSeq<'a, W>;
type SerializeStruct = SerializeStruct<'a, W>;
type SerializeStructVariant = Impossible;
type SerializeTuple = Impossible;
type SerializeTupleStruct = Impossible;
type SerializeTupleVariant = Impossible;
type SerializeMap = SerializeMap<'a, W>;
type SerializeStruct = SerializeStruct<'a, W>;
type SerializeStructVariant = Impossible;
fn serialize_bool(self, v: bool) -> Result<Self::Ok, Self::Error> {
self.check_state(Tag::Byte)?;

View file

@ -33,15 +33,15 @@ fn not_compound<T>(typ: &str) -> Result<T, Error> {
}
impl<'a, W: Write> Serializer for &'a mut RootSerializer<'_, W> {
type Error = Error;
type Ok = ();
type SerializeMap = SerializeMap<'a, W>;
type Error = Error;
type SerializeSeq = Impossible;
type SerializeStruct = SerializeStruct<'a, W>;
type SerializeStructVariant = Impossible;
type SerializeTuple = Impossible;
type SerializeTupleStruct = Impossible;
type SerializeTupleVariant = Impossible;
type SerializeMap = SerializeMap<'a, W>;
type SerializeStruct = SerializeStruct<'a, W>;
type SerializeStructVariant = Impossible;
fn serialize_bool(self, _v: bool) -> Result<Self::Ok, Self::Error> {
not_compound("bool")

View file

@ -50,8 +50,8 @@ impl<'w, W: Write + ?Sized> SerializeSeq<'w, W> {
}
impl<W: Write + ?Sized> ser::SerializeSeq for SerializeSeq<'_, W> {
type Error = Error;
type Ok = ();
type Error = Error;
fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
where

View file

@ -11,8 +11,8 @@ pub struct SerializeStruct<'w, W: ?Sized> {
}
impl<W: Write + ?Sized> ser::SerializeStruct for SerializeStruct<'_, W> {
type Error = Error;
type Ok = ();
type Error = Error;
fn serialize_field<T: ?Sized>(
&mut self,

View file

@ -488,13 +488,6 @@ impl<'de, 'a> Visitor<'de> for DeserializeListElement<'a> {
visit!(self, Double, v, E)
}
fn visit_string<E>(self, v: String) -> Result<Self::Value, E>
where
E: Error,
{
visit!(self, String, v, E)
}
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
where
E: Error,
@ -502,6 +495,13 @@ impl<'de, 'a> Visitor<'de> for DeserializeListElement<'a> {
visit!(self, String, v.to_owned(), E)
}
fn visit_string<E>(self, v: String) -> Result<Self::Value, E>
where
E: Error,
{
visit!(self, String, v, E)
}
fn visit_seq<A>(self, seq: A) -> Result<Self::Value, A::Error>
where
A: SeqAccess<'de>,