diff --git a/Cargo.toml b/Cargo.toml index ca66a7c66..507193a29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [package] name = "xattr" +edition = "2021" version = "0.2.3" authors = ["Steven Allen "] description = "unix extended filesystem attributes" diff --git a/src/lib.rs b/src/lib.rs index bf00b37f3..f80e71da2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::comparison_chain)] //! A pure-Rust library to manage extended attributes. //! //! It provides support for manipulating extended attributes @@ -25,8 +26,6 @@ //! } //! ``` -extern crate libc; - mod error; mod sys; mod util; diff --git a/src/sys/linux_macos/mod.rs b/src/sys/linux_macos/mod.rs index c0e86fe31..7cca3e083 100644 --- a/src/sys/linux_macos/mod.rs +++ b/src/sys/linux_macos/mod.rs @@ -19,7 +19,7 @@ use std::path::Path; use libc::{c_char, c_void, size_t}; -use util::{allocate_loop, name_to_c, path_to_c}; +use crate::util::{allocate_loop, name_to_c, path_to_c}; /// An iterator over a set of extended attributes names. pub struct XAttrs { diff --git a/src/sys/mod.rs b/src/sys/mod.rs index 4724826b5..756a31605 100644 --- a/src/sys/mod.rs +++ b/src/sys/mod.rs @@ -9,6 +9,7 @@ macro_rules! platforms { pub use self::$module::*; #[cfg(any($(target_os = $platform),*))] + #[allow(deprecated)] // other platforms still use ENOATTR pub const ENOATTR: ::libc::c_int = ::libc::ENOATTR; )* diff --git a/src/util.rs b/src/util.rs index d107694b6..ea80062e6 100644 --- a/src/util.rs +++ b/src/util.rs @@ -10,7 +10,7 @@ use libc::{ssize_t, ERANGE}; // Need to use this one as libc only defines this on supported platforms. Given // that we want to at least compile on unsupported platforms, we define this in // our platform-specific modules. -use sys::ENOATTR; +use crate::sys::ENOATTR; #[allow(dead_code)] pub fn name_to_c(name: &OsStr) -> io::Result { diff --git a/tests/main.rs b/tests/main.rs index 0c4367862..c93987e3c 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -1,6 +1,3 @@ -extern crate tempfile; -extern crate xattr; - use std::collections::BTreeSet; use std::ffi::OsStr; use xattr::FileExt; @@ -98,14 +95,16 @@ fn test_multi() { OsStr::new("user.test1"), OsStr::new("user.test2"), OsStr::new("user.test3"), - ].iter() - .cloned() - .collect(); + ] + .iter() + .cloned() + .collect(); for it in &items { tmp.set_xattr(it, b"value").unwrap(); } - for it in tmp.list_xattr() + for it in tmp + .list_xattr() .unwrap() .filter(|x| x.as_bytes().starts_with(&*b"user.")) {