Loading crates/fs-mistrust/src/dir.rs +4 −4 Original line number Diff line number Diff line Loading @@ -280,7 +280,7 @@ mod test { #[cfg(target_family = "unix")] { let e = sd.make_directory("d/sub2").unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); } // Try opening a file that exists. Loading @@ -289,9 +289,9 @@ mod test { #[cfg(target_family = "unix")] { let e = sd.open("c/f2", OpenOptions::new().read(true)).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); let e = sd.open("d/f3", OpenOptions::new().read(true)).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); } // Try creating a file. Loading @@ -306,7 +306,7 @@ mod test { let e = sd .open("d/f-new", OpenOptions::new().write(true).create(true)) .unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); } } Loading crates/fs-mistrust/src/err.rs +2 −2 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ impl Error { Some( match self { Error::NotFound(pb) => pb, Error::BadPermission(pb, _) => pb, Error::BadPermission(pb, ..) => pb, Error::BadOwner(pb, _) => pb, Error::BadType(pb) => pb, Error::CouldNotInspect(pb, _) => pb, Loading Loading @@ -162,7 +162,7 @@ impl Error { /// us from looking at permissions in the first place) pub fn is_bad_permission(&self) -> bool { match self { Error::BadPermission(_, _) | Error::BadOwner(_, _) | Error::BadType(_) => true, Error::BadPermission(..) | Error::BadOwner(_, _) | Error::BadType(_) => true, Error::NotFound(_) | Error::CouldNotInspect(_, _) Loading crates/fs-mistrust/src/lib.rs +6 −6 Original line number Diff line number Diff line Loading @@ -809,10 +809,10 @@ mod test { // These will fail, since the file or directory is readable. let e = m.verifier().check(d.path("a/b")).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); assert_eq!(e.path().unwrap(), d.path("a/b").canonicalize().unwrap()); let e = m.verifier().check(d.path("a/b/c")).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); assert_eq!(e.path().unwrap(), d.path("a/b/c").canonicalize().unwrap()); // Now allow readable targets. Loading Loading @@ -855,7 +855,7 @@ mod test { assert!(matches!(e, Error::Multiple(_))); let errs: Vec<_> = e.errors().collect(); assert_eq!(2, errs.len()); assert!(matches!(&errs[0], Error::BadPermission(_, _))); assert!(matches!(&errs[0], Error::BadPermission(..))); assert!(matches!(&errs[1], Error::NotFound(_))); } Loading Loading @@ -906,7 +906,7 @@ mod test { // By default, we shouldn't be accept this directory, since it is // group-writable. let e = m.check_directory(d.path("a/b")).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); // But we can make the group trusted, which will make it okay for the // directory to be group-writable. Loading @@ -927,7 +927,7 @@ mod test { .unwrap(); let e = m.check_directory(d.path("a/b")).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); } #[test] Loading @@ -945,7 +945,7 @@ mod test { // Try once with bad permissions. d.chmod("a", 0o777); let e = m.make_directory(d.path("a/b/c/d")).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); // Now make the permissions correct. d.chmod("a", 0o0700); Loading Loading
crates/fs-mistrust/src/dir.rs +4 −4 Original line number Diff line number Diff line Loading @@ -280,7 +280,7 @@ mod test { #[cfg(target_family = "unix")] { let e = sd.make_directory("d/sub2").unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); } // Try opening a file that exists. Loading @@ -289,9 +289,9 @@ mod test { #[cfg(target_family = "unix")] { let e = sd.open("c/f2", OpenOptions::new().read(true)).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); let e = sd.open("d/f3", OpenOptions::new().read(true)).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); } // Try creating a file. Loading @@ -306,7 +306,7 @@ mod test { let e = sd .open("d/f-new", OpenOptions::new().write(true).create(true)) .unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); } } Loading
crates/fs-mistrust/src/err.rs +2 −2 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ impl Error { Some( match self { Error::NotFound(pb) => pb, Error::BadPermission(pb, _) => pb, Error::BadPermission(pb, ..) => pb, Error::BadOwner(pb, _) => pb, Error::BadType(pb) => pb, Error::CouldNotInspect(pb, _) => pb, Loading Loading @@ -162,7 +162,7 @@ impl Error { /// us from looking at permissions in the first place) pub fn is_bad_permission(&self) -> bool { match self { Error::BadPermission(_, _) | Error::BadOwner(_, _) | Error::BadType(_) => true, Error::BadPermission(..) | Error::BadOwner(_, _) | Error::BadType(_) => true, Error::NotFound(_) | Error::CouldNotInspect(_, _) Loading
crates/fs-mistrust/src/lib.rs +6 −6 Original line number Diff line number Diff line Loading @@ -809,10 +809,10 @@ mod test { // These will fail, since the file or directory is readable. let e = m.verifier().check(d.path("a/b")).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); assert_eq!(e.path().unwrap(), d.path("a/b").canonicalize().unwrap()); let e = m.verifier().check(d.path("a/b/c")).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); assert_eq!(e.path().unwrap(), d.path("a/b/c").canonicalize().unwrap()); // Now allow readable targets. Loading Loading @@ -855,7 +855,7 @@ mod test { assert!(matches!(e, Error::Multiple(_))); let errs: Vec<_> = e.errors().collect(); assert_eq!(2, errs.len()); assert!(matches!(&errs[0], Error::BadPermission(_, _))); assert!(matches!(&errs[0], Error::BadPermission(..))); assert!(matches!(&errs[1], Error::NotFound(_))); } Loading Loading @@ -906,7 +906,7 @@ mod test { // By default, we shouldn't be accept this directory, since it is // group-writable. let e = m.check_directory(d.path("a/b")).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); // But we can make the group trusted, which will make it okay for the // directory to be group-writable. Loading @@ -927,7 +927,7 @@ mod test { .unwrap(); let e = m.check_directory(d.path("a/b")).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); } #[test] Loading @@ -945,7 +945,7 @@ mod test { // Try once with bad permissions. d.chmod("a", 0o777); let e = m.make_directory(d.path("a/b/c/d")).unwrap_err(); assert!(matches!(e, Error::BadPermission(_, _))); assert!(matches!(e, Error::BadPermission(..))); // Now make the permissions correct. d.chmod("a", 0o0700); Loading