Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "libblkid-rs"
version = "0.4.2"
authors = ["John Baublitz <jbaublitz@redhat.com>"]
edition = "2021"
edition = "2024"
rust-version = "1.87.0" # LOWEST SUPPORTED RUST TOOLCHAIN
description = "High level bindings for libblkid"
license = "MPL-2.0"
Expand Down Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion src/deprecated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
use std::{ffi::CString, ptr};

use crate::{
Result,
consts::{BlkidProbreqFlags, BlkidUsageFlags},
err::BlkidErr,
probe::BlkidProbe,
Result,
};

impl BlkidProbe {
Expand Down
2 changes: 1 addition & 1 deletion src/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F>(string: &str, closure: F) -> Result<String>
Expand Down
9 changes: 7 additions & 2 deletions src/err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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}"
),
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};
6 changes: 1 addition & 5 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}};
}

Expand Down
2 changes: 1 addition & 1 deletion src/partition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::{
};

use crate::{
Result,
consts::{
BlkidFltr, BlkidFullprobeRet, BlkidProbeRet, BlkidProbreqFlags, BlkidSafeprobeRet,
BlkidSublksFlags, BlkidUsageFlags,
Expand All @@ -18,7 +19,6 @@ use crate::{
err::BlkidErr,
partition::BlkidPartlist,
topology::BlkidTopology,
Result,
};

/// A structure for probing block devices.
Expand Down
2 changes: 1 addition & 1 deletion src/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading