Thanks clippy

This commit is contained in:
Jon Gjengset 2024-03-31 10:31:50 +02:00
parent abc26f3fb7
commit b60ac6d3da
8 changed files with 18 additions and 18 deletions

View file

@ -247,27 +247,27 @@ impl<'a, T: Read + Write + 'a> Drop for Handle<'a, T> {
} }
} }
impl<'a> SetReadTimeout for Connection { impl SetReadTimeout for Connection {
fn set_read_timeout(&mut self, timeout: Option<Duration>) -> Result<()> { fn set_read_timeout(&mut self, timeout: Option<Duration>) -> Result<()> {
self.deref_mut().set_read_timeout(timeout) self.deref_mut().set_read_timeout(timeout)
} }
} }
impl<'a> SetReadTimeout for TcpStream { impl SetReadTimeout for TcpStream {
fn set_read_timeout(&mut self, timeout: Option<Duration>) -> Result<()> { fn set_read_timeout(&mut self, timeout: Option<Duration>) -> Result<()> {
TcpStream::set_read_timeout(self, timeout).map_err(Error::Io) TcpStream::set_read_timeout(self, timeout).map_err(Error::Io)
} }
} }
#[cfg(feature = "native-tls")] #[cfg(feature = "native-tls")]
impl<'a> SetReadTimeout for TlsStream<TcpStream> { impl SetReadTimeout for TlsStream<TcpStream> {
fn set_read_timeout(&mut self, timeout: Option<Duration>) -> Result<()> { fn set_read_timeout(&mut self, timeout: Option<Duration>) -> Result<()> {
self.get_ref().set_read_timeout(timeout).map_err(Error::Io) self.get_ref().set_read_timeout(timeout).map_err(Error::Io)
} }
} }
#[cfg(feature = "rustls-tls")] #[cfg(feature = "rustls-tls")]
impl<'a> SetReadTimeout for RustlsStream<TcpStream> { impl SetReadTimeout for RustlsStream<TcpStream> {
fn set_read_timeout(&mut self, timeout: Option<Duration>) -> Result<()> { fn set_read_timeout(&mut self, timeout: Option<Duration>) -> Result<()> {
self.get_ref().set_read_timeout(timeout).map_err(Error::Io) self.get_ref().set_read_timeout(timeout).map_err(Error::Io)
} }

View file

@ -32,7 +32,7 @@ impl ExtendedNames {
ExtendedNamesTryBuilder { ExtendedNamesTryBuilder {
data: owned, data: owned,
extended_names_builder: |input| { extended_names_builder: |input| {
let mut lines: &[u8] = &input; let mut lines: &[u8] = input;
let mut names = Vec::new(); let mut names = Vec::new();
let mut current_name: Option<Name<'_>> = None; let mut current_name: Option<Name<'_>> = None;
let mut current_mailbox: Option<Mailbox> = None; let mut current_mailbox: Option<Mailbox> = None;

View file

@ -33,12 +33,12 @@ impl CmdListItemFormat for Metadata {
"{} {}", "{} {}",
validate_str( validate_str(
synopsis, synopsis,
&format!("entry#{}", item_index + 1), format!("entry#{}", item_index + 1),
self.entry.as_str() self.entry.as_str()
)?, )?,
self.value self.value
.as_ref() .as_ref()
.map(|v| validate_str(synopsis, &format!("value#{}", item_index + 1), v.as_str())) .map(|v| validate_str(synopsis, format!("value#{}", item_index + 1), v.as_str()))
.unwrap_or_else(|| Ok("NIL".to_string()))? .unwrap_or_else(|| Ok("NIL".to_string()))?
)) ))
} }

View file

@ -162,12 +162,12 @@ pub struct Acl<'a> {
impl<'a> Acl<'a> { impl<'a> Acl<'a> {
/// Return the mailbox the ACL entries belong to /// Return the mailbox the ACL entries belong to
pub fn mailbox(&self) -> &str { pub fn mailbox(&self) -> &str {
&*self.mailbox &self.mailbox
} }
/// Returns a list of identifier/rights pairs for the mailbox /// Returns a list of identifier/rights pairs for the mailbox
pub fn acls(&self) -> &[AclEntry<'_>] { pub fn acls(&self) -> &[AclEntry<'_>] {
&*self.acls &self.acls
} }
} }
@ -244,12 +244,12 @@ pub struct ListRights<'a> {
impl ListRights<'_> { impl ListRights<'_> {
/// Returns the mailbox for the rights /// Returns the mailbox for the rights
pub fn mailbox(&self) -> &str { pub fn mailbox(&self) -> &str {
&*self.mailbox &self.mailbox
} }
/// Returns the user identifier for the rights /// Returns the user identifier for the rights
pub fn identifier(&self) -> &str { pub fn identifier(&self) -> &str {
&*self.identifier &self.identifier
} }
/// Returns the set of rights that are always provided for this identifier /// Returns the set of rights that are always provided for this identifier
@ -318,7 +318,7 @@ pub struct MyRights<'a> {
impl MyRights<'_> { impl MyRights<'_> {
/// Returns the mailbox for the rights /// Returns the mailbox for the rights
pub fn mailbox(&self) -> &str { pub fn mailbox(&self) -> &str {
&*self.mailbox &self.mailbox
} }
/// Returns the rights for the mailbox /// Returns the rights for the mailbox

View file

@ -64,7 +64,7 @@ impl Capabilities {
} }
/// Check if the server has the given capability. /// Check if the server has the given capability.
pub fn has<'a>(&self, cap: &Capability<'a>) -> bool { pub fn has(&self, cap: &Capability<'_>) -> bool {
self.borrow_capabilities().contains(cap) self.borrow_capabilities().contains(cap)
} }

View file

@ -64,7 +64,7 @@ impl Deleted {
pub fn from_expunged(v: Vec<u32>, mod_seq: Option<u64>) -> Self { pub fn from_expunged(v: Vec<u32>, mod_seq: Option<u64>) -> Self {
Self { Self {
messages: DeletedMessages::Expunged(v), messages: DeletedMessages::Expunged(v),
mod_seq: mod_seq, mod_seq,
} }
} }
@ -73,7 +73,7 @@ impl Deleted {
pub fn from_vanished(v: Vec<RangeInclusive<u32>>, mod_seq: Option<u64>) -> Self { pub fn from_vanished(v: Vec<RangeInclusive<u32>>, mod_seq: Option<u64>) -> Self {
Self { Self {
messages: DeletedMessages::Vanished(v), messages: DeletedMessages::Vanished(v),
mod_seq: mod_seq, mod_seq,
} }
} }

View file

@ -92,7 +92,7 @@ impl<'a> Name<'a> {
/// the name is also valid as an argument for commands, such as `SELECT`, that accept mailbox /// the name is also valid as an argument for commands, such as `SELECT`, that accept mailbox
/// names. /// names.
pub fn name(&self) -> &str { pub fn name(&self) -> &str {
&*self.name &self.name
} }
/// Get an owned version of this [`Name`]. /// Get an owned version of this [`Name`].

View file

@ -234,7 +234,7 @@ impl QuotaRootResponse {
/// The mailbox name /// The mailbox name
pub fn mailbox_name(&self) -> &str { pub fn mailbox_name(&self) -> &str {
&*self.borrow_inner().quota_root.mailbox_name &self.borrow_inner().quota_root.mailbox_name
} }
/// The list of quota roots for the mailbox name (could be empty) /// The list of quota roots for the mailbox name (could be empty)
@ -243,7 +243,7 @@ impl QuotaRootResponse {
.quota_root .quota_root
.quota_root_names .quota_root_names
.iter() .iter()
.map(|e| &*e.as_ref()) .map(|e| e.as_ref())
} }
/// The set of quotas for each named quota root (could be empty) /// The set of quotas for each named quota root (could be empty)