Skip to content

Commit 712babc

Browse files
authored
Merge pull request #75 from sylvestre/clippy
Some clippy fixes
2 parents a570d8a + 700a74e commit 712babc

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

examples/arch.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
// spell-checker:ignore (API) nodename osname sysname
55

6-
use platform_info::*;
6+
use platform_info::{PlatformInfo, PlatformInfoAPI, UNameAPI};
77

88
fn main() {
99
let info = PlatformInfo::new().unwrap_or_else(|err| {
10-
eprintln!("Unable to determine platform info: {}", err);
10+
eprintln!("Unable to determine platform info: {err}");
1111
std::process::exit(1);
1212
});
1313
println!(

examples/ex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// spell-checker:ignore (API) nodename osname sysname
55

6-
use platform_info::*;
6+
use platform_info::{PlatformInfo, PlatformInfoAPI, UNameAPI};
77

88
fn main() {
99
let info = PlatformInfo::new().expect("Unable to determine platform info");

src/lib_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::path::PathBuf;
1111

1212
/// Standard thread-safe error type
1313
pub type ThreadSafeStdError = dyn std::error::Error + Send + Sync;
14-
/// Standard thread-safe error type (boxed to allow translation for any std::error::Error type)
14+
/// Standard thread-safe error type (boxed to allow translation for any `std::error::Error` type)
1515
pub type BoxedThreadSafeStdError = Box<ThreadSafeStdError>;
1616

1717
/// A slice of a path string

src/platform/unix.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::fmt::{Debug, Formatter};
2525

2626
use crate::{PlatformInfoAPI, PlatformInfoError, UNameAPI};
2727

28-
use unix_safe::*;
28+
use unix_safe::{oss_from_cstr, utsname};
2929

3030
// PlatformInfo
3131
/// Handles initial retrieval and holds cached information for the current platform (a Unix-like OS in this case).
@@ -162,7 +162,7 @@ impl PartialEq for UTSName {
162162
target_os = "netbsd"
163163
)))]
164164
{
165-
equal = equal && (self.0.domainname == other.0.domainname)
165+
equal = equal && (self.0.domainname == other.0.domainname);
166166
}
167167
equal
168168
}
@@ -181,7 +181,7 @@ mod unix_safe {
181181
use std::os::unix::ffi::OsStrExt;
182182

183183
// oss_from_str()
184-
/// *Returns* an OsString created from a libc::c_char slice.
184+
/// *Returns* an `OsString` created from a `libc::c_char` slice.
185185
pub fn oss_from_cstr(slice: &[libc::c_char]) -> OsString {
186186
assert!(slice.len() < usize::try_from(isize::MAX).unwrap());
187187
assert!(slice.iter().position(|&c| c == 0 /* NUL */).unwrap() < slice.len());
@@ -219,7 +219,7 @@ fn test_osname() {
219219
#[test]
220220
fn structure_clone() {
221221
let info = PlatformInfo::new().unwrap();
222-
println!("{:?}", info);
222+
println!("{info:?}");
223223
#[allow(clippy::redundant_clone)] // ignore `clippy::redundant_clone` warning for direct testing
224224
let info_copy = info.clone();
225225
assert_eq!(info_copy, info);

tests/integration_test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn platform_clone() -> Result<(), String> {
5050
let info = PlatformInfo::new().unwrap();
5151
#[allow(clippy::redundant_clone)] // ignore `clippy::redundant_clone` warning for direct testing
5252
let info_copy = info.clone();
53-
println!("{:?}", info);
53+
println!("{info:?}");
5454
assert_eq!(info_copy, info);
5555
Ok(())
5656
}

0 commit comments

Comments
 (0)