diff --git a/Cargo.toml b/Cargo.toml index b34cb52..75fd2df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "libblkid-rs" version = "0.4.2" authors = ["John Baublitz "] -edition = "2021" +edition = "2024" rust-version = "1.87.0" # LOWEST SUPPORTED RUST TOOLCHAIN description = "High level bindings for libblkid" license = "MPL-2.0" @@ -33,6 +33,7 @@ future_incompatible = { level = "deny", priority = 1 } unused = { level = "deny", priority = 2} rust_2018_idioms = { level = "deny", priority = 3 } nonstandard_style = { level = "deny", priority = 4 } +rust-2024-compatibility = { level = "deny", priority = 5} [lints.clippy] all = { level = "deny" } diff --git a/src/deprecated.rs b/src/deprecated.rs index 44c5ff4..088c953 100644 --- a/src/deprecated.rs +++ b/src/deprecated.rs @@ -5,10 +5,10 @@ use std::{ffi::CString, ptr}; use crate::{ + Result, consts::{BlkidProbreqFlags, BlkidUsageFlags}, err::BlkidErr, probe::BlkidProbe, - Result, }; impl BlkidProbe { diff --git a/src/encode.rs b/src/encode.rs index 5db4e94..9591515 100644 --- a/src/encode.rs +++ b/src/encode.rs @@ -6,7 +6,7 @@ use std::ffi::CString; use libc::{c_char, c_int}; -use crate::{err::BlkidErr, Result}; +use crate::{Result, err::BlkidErr}; // Shared code for encoding methods fn string_shared(string: &str, closure: F) -> Result diff --git a/src/err.rs b/src/err.rs index 251aa84..b51dc5c 100644 --- a/src/err.rs +++ b/src/err.rs @@ -61,7 +61,9 @@ impl Display for BlkidErr { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { BlkidErr::Null(ref e) => write!(f, "Null error during string conversion: {e}"), - BlkidErr::BytesWithNull(ref e) => write!(f, "Null error when converting from slice: {e}"), + BlkidErr::BytesWithNull(ref e) => { + write!(f, "Null error when converting from slice: {e}") + } BlkidErr::IntoString(ref e) => write!(f, "Could not convert C string to string: {e}"), BlkidErr::PositiveReturnCode => { write!(f, "Positive return code found when <= 0 was expected") @@ -72,7 +74,10 @@ impl Display for BlkidErr { BlkidErr::IO(ref e) => write!(f, "An IO error occurred: {e}"), BlkidErr::Uuid(ref e) => write!(f, "A UUID error occurred: {e}"), BlkidErr::Other(ref s) => write!(f, "{s}"), - BlkidErr::LibErr(code) => write!(f, "libblkid returned an error code indicating an operation could not be completed successfully: {code}"), + BlkidErr::LibErr(code) => write!( + f, + "libblkid returned an error code indicating an operation could not be completed successfully: {code}" + ), } } } diff --git a/src/lib.rs b/src/lib.rs index 685ac29..36699c0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -50,16 +50,16 @@ pub use crate::{ cache::BlkidCache, consts::*, dev::{BlkidDev, BlkidDevIter}, - devno::{maj_t, min_t, BlkidDevno}, + devno::{BlkidDevno, maj_t, min_t}, encode::{encode_string, safe_string}, err::{BlkidErr, Result}, partition::{BlkidPartition, BlkidPartlist, BlkidParttable}, probe::{ - get_partition_name, get_superblock_name, is_known_fs_type, is_known_partition_type, - BlkidProbe, + BlkidProbe, get_partition_name, get_superblock_name, is_known_fs_type, + is_known_partition_type, }, - tag::{parse_tag_string, BlkidTagIter}, + tag::{BlkidTagIter, parse_tag_string}, topology::BlkidTopology, - utils::{evaluate_spec, evaluate_tag, send_uevent, BlkidSectors}, + utils::{BlkidSectors, evaluate_spec, evaluate_tag, send_uevent}, version::{get_library_version, parse_version_string}, }; diff --git a/src/macros.rs b/src/macros.rs index 9ccc0b5..08de4d0 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -44,11 +44,7 @@ macro_rules! errno_ptr { macro_rules! option_ptr { ($ret_expr:expr) => {{ let ptr = $ret_expr; - if ptr.is_null() { - None - } else { - Some(ptr) - } + if ptr.is_null() { None } else { Some(ptr) } }}; } diff --git a/src/partition.rs b/src/partition.rs index 4ea54f5..b6de5d1 100644 --- a/src/partition.rs +++ b/src/partition.rs @@ -7,10 +7,10 @@ use std::{ffi::CStr, marker::PhantomData}; use uuid::Uuid; use crate::{ + Result, devno::BlkidDevno, err::BlkidErr, utils::{BlkidBytes, BlkidSectors}, - Result, }; /// A handle for working with partition tables. diff --git a/src/probe.rs b/src/probe.rs index 7c2b164..28b043b 100644 --- a/src/probe.rs +++ b/src/probe.rs @@ -10,6 +10,7 @@ use std::{ }; use crate::{ + Result, consts::{ BlkidFltr, BlkidFullprobeRet, BlkidProbeRet, BlkidProbreqFlags, BlkidSafeprobeRet, BlkidSublksFlags, BlkidUsageFlags, @@ -18,7 +19,6 @@ use crate::{ err::BlkidErr, partition::BlkidPartlist, topology::BlkidTopology, - Result, }; /// A structure for probing block devices. diff --git a/src/tag.rs b/src/tag.rs index 9cdfab0..21000a2 100644 --- a/src/tag.rs +++ b/src/tag.rs @@ -9,7 +9,7 @@ use std::{ use libc::c_char; -use crate::{err::BlkidErr, Result}; +use crate::{Result, err::BlkidErr}; /// Iterator for tags associated with a device pub struct BlkidTagIter(libblkid_rs_sys::blkid_tag_iterate); diff --git a/src/utils.rs b/src/utils.rs index 20a5a21..3ff6035 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -10,7 +10,7 @@ use std::{ use either::Either; -use crate::{cache::BlkidCache, err::BlkidErr, Result}; +use crate::{Result, cache::BlkidCache, err::BlkidErr}; const SECTOR_SIZE: libblkid_rs_sys::blkid_loff_t = 512;