mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 02:08:09 +00:00
uucore/refactor ~ fix cargo clippy
complaints (*allow* temporary_cstring_as_ptr; added FixME note)
* otherwise, unsure how to fix this; the following change ```rust let res = unsafe { utmpxname(CString::new(f).unwrap().as_ptr()) }; ``` to ```rust let string_ptr = CString::new(f).unwrap().as_ptr(); let res = unsafe { utmpxname(string_ptr) }; ``` causes three `who` tests (test_who::test_all, test_who::test_boot, and test_who::test_login) to fail by generating no output.
This commit is contained in:
parent
3dc9f76c7f
commit
2b4b31a9ee
1 changed files with 2 additions and 0 deletions
|
@ -242,6 +242,8 @@ impl UtmpxIter {
|
|||
///
|
||||
/// If not set, default record file will be used(file path depends on the target OS)
|
||||
pub fn read_from(self, f: &str) -> Self {
|
||||
// FixME: discuss and revise a rewrite which is correct and satisfies clippy/rustc
|
||||
#[allow(clippy::temporary_cstring_as_ptr)]
|
||||
let res = unsafe { utmpxname(CString::new(f).unwrap().as_ptr()) };
|
||||
if res != 0 {
|
||||
println!("Warning: {}", IOError::last_os_error());
|
||||
|
|
Loading…
Reference in a new issue