Skip to content

Commit

Permalink
chore: 2021 edition and friends
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Nov 29, 2022
1 parent cb96edf commit beeae6d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
@@ -1,5 +1,6 @@
[package]
name = "xattr"
edition = "2021"
version = "0.2.3"
authors = ["Steven Allen <steven@stebalien.com>"]
description = "unix extended filesystem attributes"
Expand Down
3 changes: 1 addition & 2 deletions 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
Expand Down Expand Up @@ -25,8 +26,6 @@
//! }
//! ```

extern crate libc;

mod error;
mod sys;
mod util;
Expand Down
2 changes: 1 addition & 1 deletion src/sys/linux_macos/mod.rs
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/sys/mod.rs
Expand Up @@ -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;
)*

Expand Down
2 changes: 1 addition & 1 deletion src/util.rs
Expand Up @@ -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<CString> {
Expand Down
13 changes: 6 additions & 7 deletions tests/main.rs
@@ -1,6 +1,3 @@
extern crate tempfile;
extern crate xattr;

use std::collections::BTreeSet;
use std::ffi::OsStr;
use xattr::FileExt;
Expand Down Expand Up @@ -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."))
{
Expand Down

0 comments on commit beeae6d

Please sign in to comment.