avoid some clippy warnings
This commit is contained in:
@ -111,7 +111,7 @@ impl ACL {
|
||||
Ok(ACL { ptr })
|
||||
}
|
||||
|
||||
pub fn create_entry<'a>(&'a mut self) -> Result<ACLEntry<'a>, nix::errno::Errno> {
|
||||
pub fn create_entry(&mut self) -> Result<ACLEntry, nix::errno::Errno> {
|
||||
let mut ptr = ptr::null_mut() as *mut c_void;
|
||||
let res = unsafe { acl_create_entry(&mut self.ptr, &mut ptr) };
|
||||
if res < 0 {
|
||||
|
@ -7,6 +7,7 @@ use futures::future::{FutureExt, TryFutureExt};
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
/// Broadcast results to registered listeners using asnyc oneshot channels
|
||||
#[derive(Default)]
|
||||
pub struct BroadcastData<T> {
|
||||
result: Option<Result<T, String>>,
|
||||
listeners: Vec<oneshot::Sender<Result<T, Error>>>,
|
||||
@ -85,7 +86,7 @@ impl<T: Clone + Send + 'static> BroadcastFuture<T> {
|
||||
let (tx, rx) = oneshot::channel::<Result<T, Error>>();
|
||||
let rx = rx
|
||||
.map_err(Error::from)
|
||||
.and_then(|res| futures::future::ready(res));
|
||||
.and_then(futures::future::ready);
|
||||
|
||||
(Self::new(Box::new(rx)), tx)
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ pub trait Reloadable: Sized {
|
||||
|
||||
/// Manages things to be stored and reloaded upon reexec.
|
||||
/// Anything which should be restorable should be instantiated via this struct's `restore` method,
|
||||
#[derive(Default)]
|
||||
pub struct Reloader {
|
||||
pre_exec: Vec<PreExecEntry>,
|
||||
}
|
||||
@ -241,7 +242,7 @@ where
|
||||
}
|
||||
if let Err(e) = reloader.take().unwrap().fork_restart() {
|
||||
log::error!("error during reload: {}", e);
|
||||
let _ = systemd_notify(SystemdNotify::Status(format!("error during reload")));
|
||||
let _ = systemd_notify(SystemdNotify::Status("error during reload".to_string()));
|
||||
}
|
||||
} else {
|
||||
log::info!("daemon shutting down...");
|
||||
|
@ -131,7 +131,7 @@ where
|
||||
|
||||
/// Filter by file name. Note that file names which aren't valid utf-8 will be treated as if
|
||||
/// they do not match the pattern.
|
||||
fn filter_file_name_regex<'a>(self, regex: &'a Regex) -> FileNameRegexFilter<'a, Self, T, E> {
|
||||
fn filter_file_name_regex(self, regex: &Regex) -> FileNameRegexFilter<Self, T, E> {
|
||||
FileNameRegexFilter { inner: self, regex }
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ impl ProcessLocker {
|
||||
|
||||
let data = locker.lock().unwrap();
|
||||
|
||||
for (_k, v) in &data.shared_guard_list {
|
||||
for v in data.shared_guard_list.values() {
|
||||
result = match result {
|
||||
None => Some(*v),
|
||||
Some(x) => if x < *v { Some(x) } else { Some(*v) },
|
||||
|
@ -87,6 +87,7 @@ pub struct Timer {
|
||||
}
|
||||
|
||||
/// Timer specification used to arm a `Timer`.
|
||||
#[derive(Default)]
|
||||
pub struct TimerSpec {
|
||||
/// The timeout to the next timer event.
|
||||
pub value: Option<Duration>,
|
||||
|
@ -32,7 +32,7 @@ pub fn read_password(query: &str) -> Result<Vec<u8>, Error> {
|
||||
bail!("tcgetattr() failed");
|
||||
}
|
||||
let mut termios = unsafe { termios.assume_init() };
|
||||
let old_termios = termios.clone();
|
||||
let old_termios = termios; // termios is a 'Copy' type
|
||||
unsafe {
|
||||
libc::cfmakeraw(&mut termios);
|
||||
}
|
||||
@ -58,7 +58,7 @@ pub fn read_password(query: &str) -> Result<Vec<u8>, Error> {
|
||||
}
|
||||
0x7F => {
|
||||
// backspace
|
||||
if password.len() > 0 {
|
||||
if !password.is_empty() {
|
||||
password.pop();
|
||||
if asterisks {
|
||||
let _ignore_error = out.write_all("\x08 \x08".as_bytes());
|
||||
@ -69,7 +69,7 @@ pub fn read_password(query: &str) -> Result<Vec<u8>, Error> {
|
||||
other => {
|
||||
password.push(other);
|
||||
if asterisks {
|
||||
let _ignore_error = out.write_all("*".as_bytes());
|
||||
let _ignore_error = out.write_all(b"*");
|
||||
let _ignore_error = out.flush();
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ pub fn fgetxattr(fd: RawFd, name: &[u8]) -> Result<Vec<u8>, nix::errno::Errno> {
|
||||
|
||||
pub fn fsetxattr(fd: RawFd, xattr: &PxarXAttr) -> Result<(), nix::errno::Errno> {
|
||||
let mut name = xattr.name.clone();
|
||||
name.push('\0' as u8);
|
||||
name.push(b'\0');
|
||||
let flags = 0 as libc::c_int;
|
||||
let result = unsafe {
|
||||
libc::fsetxattr(fd, name.as_ptr() as *const libc::c_char, xattr.value.as_ptr() as *const libc::c_void, xattr.value.len(), flags)
|
||||
|
Reference in New Issue
Block a user