some minor clippy lint cleanups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-07-07 09:44:50 +02:00
parent 2aeeb83203
commit ce859656ec
6 changed files with 8 additions and 11 deletions

View File

@ -10,7 +10,6 @@ use std::time::Instant;
use anyhow::*; use anyhow::*;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use libc;
use nix::unistd::Pid; use nix::unistd::Pid;
use crate::tools::fs::file_read_firstline; use crate::tools::fs::file_read_firstline;

View File

@ -253,7 +253,7 @@ impl<'a> IntoIterator for &'a MountInfo {
type IntoIter = Iter<'a>; type IntoIter = Iter<'a>;
fn into_iter(self) -> Self::IntoIter { fn into_iter(self) -> Self::IntoIter {
(&self.entries).into_iter() self.entries.iter()
} }
} }
@ -262,7 +262,7 @@ impl<'a> IntoIterator for &'a mut MountInfo {
type IntoIter = IterMut<'a>; type IntoIter = IterMut<'a>;
fn into_iter(self) -> Self::IntoIter { fn into_iter(self) -> Self::IntoIter {
(&mut self.entries).into_iter() self.entries.iter_mut()
} }
} }

View File

@ -135,7 +135,7 @@ pub fn read_password(query: &str) -> Result<Vec<u8>, Error> {
9 => asterisks = false, // tab disables echo 9 => asterisks = false, // tab disables echo
0xA | 0xD => { 0xA | 0xD => {
// newline, we're done // newline, we're done
let _ignore_error = out.write_all("\r\n".as_bytes()); let _ignore_error = out.write_all(b"\r\n");
let _ignore_error = out.flush(); let _ignore_error = out.flush();
break; break;
} }
@ -144,7 +144,7 @@ pub fn read_password(query: &str) -> Result<Vec<u8>, Error> {
if !password.is_empty() { if !password.is_empty() {
password.pop(); password.pop();
if asterisks { if asterisks {
let _ignore_error = out.write_all("\x08 \x08".as_bytes()); let _ignore_error = out.write_all(b"\x08 \x08");
let _ignore_error = out.flush(); let _ignore_error = out.flush();
} }
} }

View File

@ -97,7 +97,7 @@ impl AsHex<'_> {
self.0.len() * 2 self.0.len() * 2
} }
pub fn to_string(self) -> String { pub fn to_hex_string(self) -> String {
use std::fmt::Write; use std::fmt::Write;
let mut s = String::with_capacity(self.display_len()); let mut s = String::with_capacity(self.display_len());
write!(&mut s, "{}", self).expect("failed to format hex string"); write!(&mut s, "{}", self).expect("failed to format hex string");

View File

@ -73,8 +73,6 @@ pub mod date_time_as_rfc3339 {
/// assert_eq!(obj, deserialized); /// assert_eq!(obj, deserialized);
/// ``` /// ```
pub mod bytes_as_base64 { pub mod bytes_as_base64 {
use base64;
use serde::{Deserialize, Deserializer, Serializer}; use serde::{Deserialize, Deserializer, Serializer};
pub fn serialize<S, T>(data: &T, serializer: S) -> Result<S::Ok, S::Error> pub fn serialize<S, T>(data: &T, serializer: S) -> Result<S::Ok, S::Error>

View File

@ -38,7 +38,7 @@ pub enum OpCode {
impl OpCode { impl OpCode {
/// Tells whether it is a control frame or not /// Tells whether it is a control frame or not
pub fn is_control(self) -> bool { pub fn is_control(self) -> bool {
return self as u8 & 0b1000 > 0; (self as u8 & 0b1000) > 0
} }
} }
@ -187,7 +187,7 @@ impl<W: AsyncWrite + Unpin> WebSocketWriter<W> {
/// and mark the frames as either 'Text' or 'Binary' /// and mark the frames as either 'Text' or 'Binary'
pub fn new(mask: Option<[u8; 4]>, text: bool, writer: W) -> WebSocketWriter<W> { pub fn new(mask: Option<[u8; 4]>, text: bool, writer: W) -> WebSocketWriter<W> {
WebSocketWriter { WebSocketWriter {
writer: writer, writer,
text, text,
mask, mask,
frame: None, frame: None,
@ -265,7 +265,7 @@ pub struct FrameHeader {
impl FrameHeader { impl FrameHeader {
/// Returns true if the frame is a control frame. /// Returns true if the frame is a control frame.
pub fn is_control_frame(&self) -> bool { pub fn is_control_frame(&self) -> bool {
return self.frametype.is_control(); self.frametype.is_control()
} }
/// Tries to parse a FrameHeader from bytes. /// Tries to parse a FrameHeader from bytes.