diff --git a/src/find/matchers/delete.rs b/src/find/matchers/delete.rs index e2c15e7..553bd8a 100644 --- a/src/find/matchers/delete.rs +++ b/src/find/matchers/delete.rs @@ -27,7 +27,7 @@ impl DeleteMatcher { }) } - pub fn new_box() -> io::Result> { + pub fn new_box() -> io::Result> { Ok(Box::new(DeleteMatcher::new()?)) } diff --git a/src/find/matchers/mod.rs b/src/find/matchers/mod.rs index 0310b4d..442891f 100644 --- a/src/find/matchers/mod.rs +++ b/src/find/matchers/mod.rs @@ -484,7 +484,7 @@ mod tests { let mut config = Config::default(); if let Err(e) = build_top_level_matcher(&[arg], &mut config) { - assert!(e.description().contains("expected an expression")); + assert!(e.to_string().contains("expected an expression")); } else { panic!("parsing arugment lists that end in -not should fail"); } @@ -521,8 +521,8 @@ mod tests { let mut config = Config::default(); if let Err(e) = build_top_level_matcher(&[arg], &mut config) { - assert!(e.description().contains("missing argument to")); - assert!(e.description().contains(arg)); + assert!(e.to_string().contains("missing argument to")); + assert!(e.to_string().contains(arg)); } else { panic!("parsing arugment lists that end in -not should fail"); } @@ -535,7 +535,7 @@ mod tests { let mut config = Config::default(); if let Err(e) = build_top_level_matcher(&[arg, "-true"], &mut config) { - assert!(e.description().contains("you have used a binary operator")); + assert!(e.to_string().contains("you have used a binary operator")); } else { panic!("parsing arugment list that begins with -or should fail"); } @@ -548,7 +548,7 @@ mod tests { let mut config = Config::default(); if let Err(e) = build_top_level_matcher(&["-true", arg], &mut config) { - assert!(e.description().contains("expected an expression")); + assert!(e.to_string().contains("expected an expression")); } else { panic!("parsing arugment list that ends with -or should fail"); } @@ -560,7 +560,7 @@ mod tests { let mut config = Config::default(); if let Err(e) = build_top_level_matcher(&["-a", "-true"], &mut config) { - assert!(e.description().contains("you have used a binary operator")); + assert!(e.to_string().contains("you have used a binary operator")); } else { panic!("parsing arugment list that begins with -a should fail"); } @@ -571,7 +571,7 @@ mod tests { let mut config = Config::default(); if let Err(e) = build_top_level_matcher(&["-true", "-a"], &mut config) { - assert!(e.description().contains("expected an expression")); + assert!(e.to_string().contains("expected an expression")); } else { panic!("parsing arugment list that ends with -or should fail"); } @@ -673,13 +673,13 @@ mod tests { let mut config = Config::default(); if let Err(e) = build_top_level_matcher(&[",", "-true"], &mut config) { - assert!(e.description().contains("you have used a binary operator")); + assert!(e.to_string().contains("you have used a binary operator")); } else { panic!("parsing arugment list that begins with , should fail"); } if let Err(e) = build_top_level_matcher(&["-true", "-o", ",", "-true"], &mut config) { - assert!(e.description().contains("you have used a binary operator")); + assert!(e.to_string().contains("you have used a binary operator")); } else { panic!("parsing arugment list that contains '-o ,' should fail"); } @@ -690,7 +690,7 @@ mod tests { let mut config = Config::default(); if let Err(e) = build_top_level_matcher(&["-true", ","], &mut config) { - assert!(e.description().contains("expected an expression")); + assert!(e.to_string().contains("expected an expression")); } else { panic!("parsing arugment list that ends with , should fail"); } @@ -701,7 +701,7 @@ mod tests { let mut config = Config::default(); if let Err(e) = build_top_level_matcher(&["-true", "("], &mut config) { - assert!(e.description().contains("I was expecting to find a ')'")); + assert!(e.to_string().contains("I was expecting to find a ')'")); } else { panic!("parsing arugment list with not enough closing brackets should fail"); } @@ -712,7 +712,7 @@ mod tests { let mut config = Config::default(); if let Err(e) = build_top_level_matcher(&["-true", "(", ")", ")"], &mut config) { - assert!(e.description().contains("too many ')'")); + assert!(e.to_string().contains("too many ')'")); } else { panic!("parsing arugment list with too many closing brackets should fail"); } @@ -909,7 +909,7 @@ mod tests { if let Err(e) = build_top_level_matcher(&["-ctime", "-123."], &mut config) { assert!( - e.description().contains("Expected a decimal integer"), + e.to_string().contains("Expected a decimal integer"), "bad description: {}", e ); @@ -923,19 +923,19 @@ mod tests { let mut config = Config::default(); if let Err(e) = build_top_level_matcher(&["-exec"], &mut config) { - assert!(e.description().contains("missing argument")); + assert!(e.to_string().contains("missing argument")); } else { panic!("parsing argument list with exec and no executable or semi-colon should fail"); } if let Err(e) = build_top_level_matcher(&["-exec", ";"], &mut config) { - assert!(e.description().contains("missing argument")); + assert!(e.to_string().contains("missing argument")); } else { panic!("parsing argument list with exec and no executable should fail"); } if let Err(e) = build_top_level_matcher(&["-exec", "foo"], &mut config) { - assert!(e.description().contains("missing argument")); + assert!(e.to_string().contains("missing argument")); } else { panic!("parsing argument list with exec and no executable should fail"); } @@ -973,13 +973,13 @@ mod tests { fn build_top_level_matcher_perm_bad() { let mut config = Config::default(); if let Err(e) = build_top_level_matcher(&["-perm", "foo"], &mut config) { - assert!(e.description().contains("invalid mode")); + assert!(e.to_string().contains("invalid mode")); } else { panic!("-perm with bad mode pattern should fail"); } if let Err(e) = build_top_level_matcher(&["-perm"], &mut config) { - assert!(e.description().contains("missing argument")); + assert!(e.to_string().contains("missing argument")); } else { panic!("-perm with no mode pattern should fail"); } @@ -990,13 +990,13 @@ mod tests { fn build_top_level_matcher_perm_not_unix() { let mut config = Config::default(); if let Err(e) = build_top_level_matcher(&["-perm", "444"], &mut config) { - assert!(e.description().contains("not available")); + assert!(e.to_string().contains("not available")); } else { panic!("-perm on non-unix systems shouldn't be available"); } if let Err(e) = build_top_level_matcher(&["-perm"], &mut config) { - assert!(e.description().contains("missing argument")); + assert!(e.to_string().contains("missing argument")); } else { panic!("-perm with no mode pattern should fail"); } diff --git a/src/find/matchers/size.rs b/src/find/matchers/size.rs index c88ae4c..233df6f 100644 --- a/src/find/matchers/size.rs +++ b/src/find/matchers/size.rs @@ -157,7 +157,7 @@ mod tests { fn size_matcher_bad_unit() { if let Err(e) = SizeMatcher::new(ComparableValue::EqualTo(2), "xyz") { assert!( - e.description().contains("Invalid suffix") && e.description().contains("xyz"), + e.to_string().contains("Invalid suffix") && e.to_string().contains("xyz"), "bad description: {}", e ); diff --git a/src/find/mod.rs b/src/find/mod.rs index f34a0c7..76f577a 100644 --- a/src/find/mod.rs +++ b/src/find/mod.rs @@ -118,9 +118,7 @@ fn process_dir<'a>( loop { match it.next() { None => break, - Some(Err(err)) => { - writeln!(&mut stderr(), "Error: {}: {}", dir, err.description()).unwrap() - } + Some(Err(err)) => writeln!(&mut stderr(), "Error: {}: {}", dir, err).unwrap(), Some(Ok(entry)) => { let mut matcher_io = matchers::MatcherIO::new(deps); if matcher.matches(&entry, &mut matcher_io) { @@ -265,7 +263,7 @@ mod tests { } impl<'a> Dependencies<'a> for FakeDependencies { - fn get_output(&'a self) -> &'a RefCell { + fn get_output(&'a self) -> &'a RefCell { &self.output } @@ -286,7 +284,7 @@ mod tests { // let result = super::parse_args(&["-asdadsafsfsadcs"]); if let Err(e) = result { - assert_eq!(e.description(), "Unrecognized flag: '-asdadsafsfsadcs'"); + assert_eq!(e.to_string(), "Unrecognized flag: '-asdadsafsfsadcs'"); } else { panic!("parse_args should have returned an error"); } diff --git a/tests/common/test_helpers.rs b/tests/common/test_helpers.rs index f2016fe..6c723d5 100644 --- a/tests/common/test_helpers.rs +++ b/tests/common/test_helpers.rs @@ -44,7 +44,7 @@ impl<'a> FakeDependencies { } impl<'a> Dependencies<'a> for FakeDependencies { - fn get_output(&'a self) -> &'a RefCell { + fn get_output(&'a self) -> &'a RefCell { &self.output }