diff --git a/src/options/filter.rs b/src/options/filter.rs index ad88ff7..75e10fe 100644 --- a/src/options/filter.rs +++ b/src/options/filter.rs @@ -295,7 +295,7 @@ mod test { mod ignore_patterns { use super::*; use std::iter::FromIterator; - use glob; + fn pat(string: &'static str) -> glob::Pattern { glob::Pattern::new(string).unwrap() diff --git a/src/options/mod.rs b/src/options/mod.rs index 5c060b6..c203176 100644 --- a/src/options/mod.rs +++ b/src/options/mod.rs @@ -228,14 +228,14 @@ pub mod test { /// both, then both should resolve to the same result. /// /// It returns a vector with one or two elements in. - /// These elements can then be tested with assert_eq or what have you. + /// These elements can then be tested with `assert_eq` or what have you. pub fn parse_for_test(inputs: &[&str], args: &'static [&'static Arg], strictnesses: Strictnesses, get: F) -> Vec where F: Fn(&MatchedFlags<'_>) -> T { use self::Strictnesses::*; use crate::options::parser::{Args, Strictness}; - let bits = inputs.into_iter().map(OsStr::new).collect::>(); + let bits = inputs.iter().map(OsStr::new).collect::>(); let mut result = Vec::new(); if strictnesses == Last || strictnesses == Both { diff --git a/src/options/theme.rs b/src/options/theme.rs index 010de4a..5d27173 100644 --- a/src/options/theme.rs +++ b/src/options/theme.rs @@ -130,18 +130,18 @@ mod terminal_test { impl MockVars { fn empty() -> MockVars { - return MockVars { + MockVars { ls: "", exa: "", no_color: "", - }; + } } fn with_no_color() -> MockVars { - return MockVars { + MockVars { ls: "", exa: "", no_color: "true", - }; + } } } diff --git a/src/options/view.rs b/src/options/view.rs index 41816fb..078d4a6 100644 --- a/src/options/view.rs +++ b/src/options/view.rs @@ -378,7 +378,7 @@ mod test { ($name:ident: $type:ident <- $inputs:expr; $stricts:expr => err $result:expr) => { /// Special macro for testing Err results. - /// This is needed because sometimes the Ok type doesn’t implement PartialEq. + /// This is needed because sometimes the Ok type doesn’t implement `PartialEq`. #[test] fn $name() { for result in parse_for_test($inputs.as_ref(), TEST_ARGS, $stricts, |mf| $type::deduce(mf)) { @@ -389,7 +389,7 @@ mod test { ($name:ident: $type:ident <- $inputs:expr; $stricts:expr => like $pat:pat) => { /// More general macro for testing against a pattern. - /// Instead of using PartialEq, this just tests if it matches a pat. + /// Instead of using `PartialEq`, this just tests if it matches a pat. #[test] fn $name() { for result in parse_for_test($inputs.as_ref(), TEST_ARGS, $stricts, |mf| $type::deduce(mf)) { diff --git a/src/output/render/blocks.rs b/src/output/render/blocks.rs index 5745f8f..cd5182d 100644 --- a/src/output/render/blocks.rs +++ b/src/output/render/blocks.rs @@ -43,7 +43,7 @@ pub mod test { let blox = f::Blocks::None; let expected = TextCell::blank(Green.italic()); - assert_eq!(expected, blox.render(&TestColours).into()); + assert_eq!(expected, blox.render(&TestColours)); } @@ -52,6 +52,6 @@ pub mod test { let blox = f::Blocks::Some(3005); let expected = TextCell::paint_str(Red.blink(), "3005"); - assert_eq!(expected, blox.render(&TestColours).into()); + assert_eq!(expected, blox.render(&TestColours)); } } diff --git a/src/output/render/git.rs b/src/output/render/git.rs index 3740d40..ae96e58 100644 --- a/src/output/render/git.rs +++ b/src/output/render/git.rs @@ -85,7 +85,7 @@ pub mod test { ].into(), }; - assert_eq!(expected, stati.render(&TestColours).into()) + assert_eq!(expected, stati.render(&TestColours)) } @@ -104,6 +104,6 @@ pub mod test { ].into(), }; - assert_eq!(expected, stati.render(&TestColours).into()) + assert_eq!(expected, stati.render(&TestColours)) } } diff --git a/src/output/render/inode.rs b/src/output/render/inode.rs index 7737aa2..8bb3249 100644 --- a/src/output/render/inode.rs +++ b/src/output/render/inode.rs @@ -21,8 +21,8 @@ pub mod test { #[test] fn blocklessness() { - let io = f::Inode(1414213); + let io = f::Inode(1_414_213); let expected = TextCell::paint_str(Cyan.underline(), "1414213"); - assert_eq!(expected, io.render(Cyan.underline()).into()); + assert_eq!(expected, io.render(Cyan.underline())); } } diff --git a/src/output/render/links.rs b/src/output/render/links.rs index 19b5f18..612a5d3 100644 --- a/src/output/render/links.rs +++ b/src/output/render/links.rs @@ -52,7 +52,7 @@ pub mod test { contents: vec![ Blue.paint("1") ].into(), }; - assert_eq!(expected, stati.render(&TestColours, &locale::Numeric::english()).into()); + assert_eq!(expected, stati.render(&TestColours, &locale::Numeric::english())); } #[test] @@ -67,7 +67,7 @@ pub mod test { contents: vec![ Blue.paint("3,005") ].into(), }; - assert_eq!(expected, stati.render(&TestColours, &locale::Numeric::english()).into()); + assert_eq!(expected, stati.render(&TestColours, &locale::Numeric::english())); } #[test] @@ -82,6 +82,6 @@ pub mod test { contents: vec![ Blue.on(Red).paint("3,005") ].into(), }; - assert_eq!(expected, stati.render(&TestColours, &locale::Numeric::english()).into()); + assert_eq!(expected, stati.render(&TestColours, &locale::Numeric::english())); } } diff --git a/src/output/render/octal.rs b/src/output/render/octal.rs index 454f756..5bb64b5 100644 --- a/src/output/render/octal.rs +++ b/src/output/render/octal.rs @@ -40,7 +40,7 @@ pub mod test { let octal = f::OctalPermissions{ permissions: bits }; let expected = TextCell::paint_str(Purple.bold(), "0755"); - assert_eq!(expected, octal.render(Purple.bold()).into()); + assert_eq!(expected, octal.render(Purple.bold())); } #[test] @@ -54,7 +54,7 @@ pub mod test { let octal = f::OctalPermissions{ permissions: bits }; let expected = TextCell::paint_str(Purple.bold(), "0644"); - assert_eq!(expected, octal.render(Purple.bold()).into()); + assert_eq!(expected, octal.render(Purple.bold())); } #[test] @@ -68,7 +68,7 @@ pub mod test { let octal = f::OctalPermissions{ permissions: bits }; let expected = TextCell::paint_str(Purple.bold(), "0600"); - assert_eq!(expected, octal.render(Purple.bold()).into()); + assert_eq!(expected, octal.render(Purple.bold())); } #[test] @@ -82,7 +82,7 @@ pub mod test { let octal = f::OctalPermissions{ permissions: bits }; let expected = TextCell::paint_str(Purple.bold(), "4777"); - assert_eq!(expected, octal.render(Purple.bold()).into()); + assert_eq!(expected, octal.render(Purple.bold())); } @@ -97,7 +97,7 @@ pub mod test { let octal = f::OctalPermissions{ permissions: bits }; let expected = TextCell::paint_str(Purple.bold(), "2777"); - assert_eq!(expected, octal.render(Purple.bold()).into()); + assert_eq!(expected, octal.render(Purple.bold())); } #[test] @@ -111,6 +111,6 @@ pub mod test { let octal = f::OctalPermissions{ permissions: bits }; let expected = TextCell::paint_str(Purple.bold(), "1777"); - assert_eq!(expected, octal.render(Purple.bold()).into()); + assert_eq!(expected, octal.render(Purple.bold())); } } diff --git a/src/output/render/size.rs b/src/output/render/size.rs index 5a3ad72..716cc48 100644 --- a/src/output/render/size.rs +++ b/src/output/render/size.rs @@ -153,7 +153,7 @@ pub mod test { #[test] fn file_bytes() { - let directory = f::Size::Some(1048576); + let directory = f::Size::Some(1_048_576); let expected = TextCell { width: DisplayWidth::from(9), contents: vec![ diff --git a/src/output/tree.rs b/src/output/tree.rs index 5e27e20..c3bff43 100644 --- a/src/output/tree.rs +++ b/src/output/tree.rs @@ -253,7 +253,7 @@ mod iter_test { #[test] fn test_iteration() { let foos = &[ "first", "middle", "last" ]; - let mut iter = TreeDepth::root().iterate_over(foos.into_iter()); + let mut iter = TreeDepth::root().iterate_over(foos.iter()); let next = iter.next().unwrap(); assert_eq!(&"first", next.1); @@ -273,7 +273,7 @@ mod iter_test { #[test] fn test_empty() { let nothing: &[usize] = &[]; - let mut iter = TreeDepth::root().iterate_over(nothing.into_iter()); + let mut iter = TreeDepth::root().iterate_over(nothing.iter()); assert!(iter.next().is_none()); } }