diff --git a/Cargo.toml b/Cargo.toml index 37eb1d6..448820e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,9 +5,10 @@ authors = ["Manuel Woelker "] description = "A virtual filesystem for Rust" repository = "https://github.com/manuel-woelker/rust-vfs" readme = "README.md" +edition = "2021" +rust-version = "1.56" keywords = ["vfs", "virtual", "filesystem", "async"] license = "Apache-2.0" -edition = "2021" [badges] travis-ci = { repository = "manuel-woelker/rust-vfs", branch = "master" } diff --git a/src/error.rs b/src/error.rs index c3af6c1..10e1628 100644 --- a/src/error.rs +++ b/src/error.rs @@ -26,9 +26,7 @@ impl From for VfsError { let kind = match kind { VfsErrorKind::IoError(io) => match io.kind() { io::ErrorKind::NotFound => VfsErrorKind::FileNotFound, - // TODO: If MSRV changes to 1.53, enable this. Alternatively, - // if it's possible to #[cfg] just this line, try that - // io::ErrorKind::Unsupported => VfsErrorKind::NotSupported, + io::ErrorKind::Unsupported => VfsErrorKind::NotSupported, _ => VfsErrorKind::IoError(io), }, // Remaining kinda are passed through as-is diff --git a/src/impls/altroot.rs b/src/impls/altroot.rs index a438c39..695c812 100644 --- a/src/impls/altroot.rs +++ b/src/impls/altroot.rs @@ -25,13 +25,12 @@ impl AltrootFS { } impl AltrootFS { - #[allow(clippy::manual_strip)] // strip prefix manually for MSRV 1.32 fn path(&self, path: &str) -> VfsResult { if path.is_empty() { return Ok(self.root.clone()); } - if path.starts_with('/') { - return self.root.join(&path[1..]); + if let Some(path) = path.strip_prefix('/') { + return self.root.join(path); } self.root.join(path) } diff --git a/src/test_macros.rs b/src/test_macros.rs index 6382cde..9131f72 100644 --- a/src/test_macros.rs +++ b/src/test_macros.rs @@ -696,7 +696,7 @@ use super::*; fn read_to_string_nonutf8() -> VfsResult<()> { let root = create_root(); let path = root.join("foobar.txt")?; - path.create_file()?.write_all(&vec![0, 159, 146, 150])?; + path.create_file()?.write_all(&[0, 159, 146, 150])?; let error_message = path.read_to_string().expect_err("read_to_string").to_string(); assert_eq!( &error_message,