From 166b495586c224b429a817742696becc1edc38dc Mon Sep 17 00:00:00 2001 From: nils <48135649+Nilstrieb@users.noreply.github.com> Date: Tue, 13 Sep 2022 16:30:25 +0200 Subject: [PATCH] fmt --- .rustfmt.toml | 3 +++ mono-fmt-macro/src/lib.rs | 2 +- src/lib.rs | 16 ++++++++-------- src/std_impl/mod.rs | 2 +- src/std_impl/num.rs | 11 ++++++----- 5 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 .rustfmt.toml diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..4d7dd9e --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,3 @@ +imports_granularity = "Crate" +newline_style = "Unix" +group_imports = "StdExternalCrate" \ No newline at end of file diff --git a/mono-fmt-macro/src/lib.rs b/mono-fmt-macro/src/lib.rs index 0ec398c..849f7a2 100644 --- a/mono-fmt-macro/src/lib.rs +++ b/mono-fmt-macro/src/lib.rs @@ -69,7 +69,7 @@ impl PartialEq for FmtPart { fn eq(&self, other: &Self) -> bool { match (self, other) { (Self::Literal(_, a), Self::Literal(_, b)) => a == b, - (Self::Spec(_ ,a, _), Self::Spec(_, b, _)) => a == b, + (Self::Spec(_, a, _), Self::Spec(_, b, _)) => a == b, _ => false, } } diff --git a/src/lib.rs b/src/lib.rs index d36ed88..e0fd5c3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,8 +12,7 @@ macro_rules! format_args { }; } -pub use crate::args::Arguments; -pub use crate::opts::FmtOpts; +pub use crate::{args::Arguments, opts::FmtOpts}; pub type Result = std::result::Result<(), Error>; @@ -118,13 +117,14 @@ pub fn format(args: A) -> String { /// Not part of the public API. #[doc(hidden)] mod _private { - pub use crate::args::{ConstWidthArg, DebugArg, DisplayArg, Str}; - - pub use crate::opts::{ - WithAlternate, WithCenterAlign, WithFill, WithLeftAlign, WithRightAlign, WithWidth, - }; - pub use mono_fmt_macro::__format_args; + + pub use crate::{ + args::{ConstWidthArg, DebugArg, DisplayArg, Str}, + opts::{ + WithAlternate, WithCenterAlign, WithFill, WithLeftAlign, WithRightAlign, WithWidth, + }, + }; } #[macro_export] diff --git a/src/std_impl/mod.rs b/src/std_impl/mod.rs index 568f1ac..4f466ec 100644 --- a/src/std_impl/mod.rs +++ b/src/std_impl/mod.rs @@ -1,4 +1,4 @@ //! Copied modified stuff from core +mod formatter; mod num; -mod formatter; \ No newline at end of file diff --git a/src/std_impl/num.rs b/src/std_impl/num.rs index cd2b441..da629cf 100644 --- a/src/std_impl/num.rs +++ b/src/std_impl/num.rs @@ -1,11 +1,12 @@ //! Integer and floating-point number formatting +use std::{ + mem::MaybeUninit, + ops::{Div, Rem, Sub}, + ptr, slice, str, +}; + use crate::{self as fmt, FmtOpts, Write}; -use std::mem::MaybeUninit; -use std::ops::{Div, Rem, Sub}; -use std::ptr; -use std::slice; -use std::str; mod numfmt { //! Shared utilities used by both float and integer formatting.