diff --git a/Makefile b/Makefile index 9736bc9..34a8563 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ CARGO_OPTS:=-q TARGET_DIR:=debug fmt: - @$(CARGO) fmt 2>/dev/null + @$(CARGO) fmt %: fmt @$(CARGO) build $(CARGO_OPTS) --bin $@ diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 198abca..d3c2c8c 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -22,7 +22,11 @@ struct IncludeData { impl Default for IncludeData { fn default() -> Self { - IncludeData { var: VAR_NAME.into(), year: None, day: None } + IncludeData { + var: VAR_NAME.into(), + year: None, + day: None, + } } } diff --git a/rustfmt.toml b/rustfmt.toml index 04e249e..37d6afe 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,13 +1,26 @@ -#binop_separator= "Back" -#brace_style="SameLineWhere" -#force_multiline_blocks = true -#imports_layout = "Vertical" array_width = 0 attr_fn_like_width = 80 +#binop_separator = "Back" +#blank_lines_lower_bound = 1 +#blank_lines_upper_bound = 2 +#brace_style = "SameLineWhere" chain_width = 144 +#combine_control_expr = false +#comment_width = 240 +#condense_wildcard_suffixes = true +#empty_item_single_line = true +#enum_discrim_align_threshold = 20 fn_params_layout = "Tall" force_explicit_abi = true +#force_multiline_blocks = true +#format_code_in_doc_comments = true +#format_macro_bodies = true hard_tabs = false +#hex_literal_case = "Upper" +#imports_granularity = "Crate" +#imports_layout = "Vertical" +#indent_style = "Block" +#inline_attribute_width = 0 match_block_trailing_comma = true max_width = 240 merge_derives = true diff --git a/src/coordinate_systems/euclidian.rs b/src/coordinate_systems/euclidian.rs index 375ab08..f7e0da0 100644 --- a/src/coordinate_systems/euclidian.rs +++ b/src/coordinate_systems/euclidian.rs @@ -53,7 +53,11 @@ impl SubAssign for Euclidian { impl Euclidian { pub const fn new(x: T, y: T, z: T) -> Self { - Self { x: x, y: y, z: z } + Self { + x, + y, + z, + } } } @@ -61,6 +65,10 @@ impl Euclidian { mod test { use super::*; fn test() { - Euclidian { x: 0, y: 0, z: 0 }; + Euclidian { + x: 0, + y: 0, + z: 0, + }; } } diff --git a/src/coordinate_systems/kartesian/direction.rs b/src/coordinate_systems/kartesian/direction.rs index f2be107..68ee01d 100644 --- a/src/coordinate_systems/kartesian/direction.rs +++ b/src/coordinate_systems/kartesian/direction.rs @@ -147,7 +147,12 @@ impl KartesianDirection { } pub fn iter(none: bool, diagonal: bool, straight: bool) -> KartesianIterator { - KartesianIterator { i: 0, none, diagonal, straight } + KartesianIterator { + i: 0, + none, + diagonal, + straight, + } } } diff --git a/src/coordinate_systems/kartesian/external_traits.rs b/src/coordinate_systems/kartesian/external_traits.rs index 92da19e..9db8a3f 100644 --- a/src/coordinate_systems/kartesian/external_traits.rs +++ b/src/coordinate_systems/kartesian/external_traits.rs @@ -5,7 +5,10 @@ use std::{fmt::Display, ops::*}; impl Add for Kartesian { fn add(self, rhs: Self) -> Self::Output { - Kartesian { x: self.x + rhs.x, y: self.y + rhs.y } + Kartesian { + x: self.x + rhs.x, + y: self.y + rhs.y, + } } type Output = Kartesian; @@ -20,7 +23,10 @@ impl AddAssign for Kartesian { impl Sub for Kartesian { fn sub(self, rhs: Self) -> Self::Output { - Kartesian { x: self.x - rhs.x, y: self.y - rhs.y } + Kartesian { + x: self.x - rhs.x, + y: self.y - rhs.y, + } } type Output = Kartesian; @@ -52,7 +58,10 @@ impl Div for Kartesian { impl Rem for Kartesian { type Output = Self; fn rem(self, rhs: Self) -> Self { - Kartesian { x: self.x % rhs.x, y: self.y % rhs.y } + Kartesian { + x: self.x % rhs.x, + y: self.y % rhs.y, + } } } impl RemAssign for Kartesian { diff --git a/src/coordinate_systems/kartesian/maximum.rs b/src/coordinate_systems/kartesian/maximum.rs index 7cfc71b..c607090 100644 --- a/src/coordinate_systems/kartesian/maximum.rs +++ b/src/coordinate_systems/kartesian/maximum.rs @@ -25,6 +25,9 @@ impl_maximum!(u128); impl MaximumFromMap for Kartesian { fn maximum(map: &Vec>) -> Kartesian { - Kartesian { x: map.len(), y: map[0].len() } + Kartesian { + x: map.len(), + y: map[0].len(), + } } } diff --git a/src/coordinate_systems/kartesian/mod.rs b/src/coordinate_systems/kartesian/mod.rs index cd1ac38..0986f95 100644 --- a/src/coordinate_systems/kartesian/mod.rs +++ b/src/coordinate_systems/kartesian/mod.rs @@ -29,7 +29,10 @@ where impl Kartesian { pub const fn new(x: T, y: T) -> Self { - Self { x: x, y: y } + Self { + x, + y, + } } } @@ -248,6 +251,12 @@ pub struct Velocity { impl Velocity { pub fn new(x: T, y: T, dir: KartesianDirection) -> Self { - Velocity { speed: Kartesian { x, y }, direction: dir } + Velocity { + speed: Kartesian { + x, + y, + }, + direction: dir, + } } } diff --git a/src/coordinate_systems/kartesian/traits.rs b/src/coordinate_systems/kartesian/traits.rs index c99967f..5713ecb 100644 --- a/src/coordinate_systems/kartesian/traits.rs +++ b/src/coordinate_systems/kartesian/traits.rs @@ -8,7 +8,10 @@ macro_rules! to_coords_impl { ($subtype:ident) => { impl ToCoords for Kartesian<$subtype> { fn to_coords(self) -> Kartesian { - Kartesian { x: self.x as usize, y: self.y as usize } + Kartesian { + x: self.x as usize, + y: self.y as usize, + } } } }; @@ -60,6 +63,9 @@ to_coords_impl!(u128); impl ToCoords for Kartesian { fn to_coords(self) -> Kartesian { - Kartesian { x: self.x, y: self.y } + Kartesian { + x: self.x, + y: self.y, + } } }