Browse Source

Fix 1.83.0 lints

Mostly lifetime ones (elided-named-lifetimes and needless-lifetimes)

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Manos Pitsidianakis 7 months ago
parent
commit
1f2fec19

+ 1 - 1
meli/src/conf/data_types/regex_pattern.rs

@@ -185,7 +185,7 @@ pub struct FindIter<'r, 's> {
     char_offset: usize,
 }
 
-impl<'r, 's> Iterator for FindIter<'r, 's> {
+impl Iterator for FindIter<'_, '_> {
     type Item = (usize, usize);
 
     fn next(&mut self) -> Option<Self::Item> {

+ 1 - 4
meli/src/terminal.rs

@@ -119,13 +119,10 @@ pub struct Hyperlink<
 }
 
 impl<
-        'a,
-        'b,
-        'i,
         T: std::fmt::Display + ?Sized,
         U: std::fmt::Display + ?Sized,
         I: std::fmt::Display + ?Sized,
-    > std::fmt::Display for Hyperlink<'a, 'b, 'i, T, U, I>
+    > std::fmt::Display for Hyperlink<'_, '_, '_, T, U, I>
 {
     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
         let id: &dyn std::fmt::Display = if let Some(ref id) = self.id { id } else { &"" };

+ 1 - 1
meli/src/terminal/keys.rs

@@ -473,7 +473,7 @@ impl<'de> Deserialize<'de> for Key {
     {
         struct KeyVisitor;
 
-        impl<'de> Visitor<'de> for KeyVisitor {
+        impl Visitor<'_> for KeyVisitor {
             type Value = Key;
 
             fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {

+ 1 - 1
melib/src/email/address.rs

@@ -604,7 +604,7 @@ impl StrBuild for MessageID {
 
 struct MessageIDBracket<'a>(&'a MessageID);
 
-impl<'a> std::fmt::Display for MessageIDBracket<'a> {
+impl std::fmt::Display for MessageIDBracket<'_> {
     fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
         write!(fmt, "<")?;
         write!(fmt, "{}", self.0)?;

+ 1 - 1
melib/src/email/attachments.rs

@@ -50,7 +50,7 @@ pub struct DecodeOptions<'att> {
     pub force_charset: Option<Charset>,
 }
 
-impl<'att> From<Option<Charset>> for DecodeOptions<'att> {
+impl From<Option<Charset>> for DecodeOptions<'_> {
     fn from(force_charset: Option<Charset>) -> Self {
         Self {
             filter: None,

+ 3 - 3
melib/src/email/headers/names.rs

@@ -340,7 +340,7 @@ impl<'a> PartialEq<&'a Self> for HeaderName {
     }
 }
 
-impl<'a> PartialEq<HeaderName> for &'a HeaderName {
+impl PartialEq<HeaderName> for &HeaderName {
     #[inline]
     fn eq(&self, other: &HeaderName) -> bool {
         *other == *self
@@ -400,7 +400,7 @@ impl<'a> PartialEq<&'a str> for HeaderName {
     }
 }
 
-impl<'a> PartialEq<HeaderName> for &'a str {
+impl PartialEq<HeaderName> for &str {
     /// Performs a case-insensitive comparison of the string against the header
     /// name
     #[inline]
@@ -491,7 +491,7 @@ struct AsciiIgnoreCaseCmp<'a, 'b> {
     b: &'b [u8],
 }
 
-impl<'a, 'b> Iterator for AsciiIgnoreCaseCmp<'a, 'b> {
+impl Iterator for AsciiIgnoreCaseCmp<'_, '_> {
     type Item = ();
 
     fn next(&mut self) -> Option<()> {

+ 13 - 13
melib/src/email/parser.rs

@@ -400,7 +400,7 @@ pub trait BytesIterExt {
     fn join(&mut self, sep: u8) -> Vec<u8>;
 }
 
-impl<'a, P: for<'r> FnMut(&'r u8) -> bool> BytesIterExt for std::slice::Split<'a, u8, P> {
+impl<P: for<'r> FnMut(&'r u8) -> bool> BytesIterExt for std::slice::Split<'_, u8, P> {
     fn join(&mut self, sep: u8) -> Vec<u8> {
         self.fold(vec![], |mut acc, el| {
             if !acc.is_empty() {
@@ -451,22 +451,22 @@ pub mod dates {
     /// In the obsolete time zone, "UT" and "GMT" are indications of
     /// "Universal Time" and "Greenwich Mean Time", respectively, and are
     /// both semantically identical to "+0000".
-
+    ///
     /// The remaining three character zones are the US time zones.  The first
     /// letter, "E", "C", "M", or "P" stands for "Eastern", "Central",
     /// "Mountain", and "Pacific".  The second letter is either "S" for
     /// "Standard" time, or "D" for "Daylight Savings" (or summer) time.
     /// Their interpretations are as follows:
-
-    ///   EDT is semantically equivalent to -0400
-    ///   EST is semantically equivalent to -0500
-    ///   CDT is semantically equivalent to -0500
-    ///   CST is semantically equivalent to -0600
-    ///   MDT is semantically equivalent to -0600
-    ///   MST is semantically equivalent to -0700
-    ///   PDT is semantically equivalent to -0700
-    ///   PST is semantically equivalent to -0800
-
+    ///
+    /// - EDT is semantically equivalent to `-0400`
+    /// - EST is semantically equivalent to `-0500`
+    /// - CDT is semantically equivalent to `-0500`
+    /// - CST is semantically equivalent to `-0600`
+    /// - MDT is semantically equivalent to `-0600`
+    /// - MST is semantically equivalent to `-0700`
+    /// - PDT is semantically equivalent to `-0700`
+    /// - PST is semantically equivalent to `-0800`
+    ///
     /// The 1 character military time zones were defined in a non-standard
     /// way in RFC0822 and are therefore unpredictable in their meaning.
     /// The original definitions of the military zones "A" through "I" are
@@ -477,7 +477,7 @@ pub mod dates {
     /// the error in RFC0822, they SHOULD all be considered equivalent to
     /// "-0000" unless there is out-of-band information confirming their
     /// meaning.
-
+    ///
     /// Other multi-character (usually between 3 and 5) alphabetic time zones
     /// have been used in Internet messages.  Any such time zone whose
     /// meaning is not known SHOULD be considered equivalent to "-0000"

+ 1 - 1
melib/src/error.rs

@@ -464,7 +464,7 @@ impl From<io::Error> for Error {
     }
 }
 
-impl<'a> From<Cow<'a, str>> for Error {
+impl From<Cow<'_, str>> for Error {
     #[inline]
     fn from(err: Cow<'_, str>) -> Self {
         Self::new(err.to_string())

+ 2 - 2
melib/src/gpgme/key.rs

@@ -171,7 +171,7 @@ pub(super) struct InvalidKeysIter<'a> {
     _ph: std::marker::PhantomData<&'a _gpgme_invalid_key>,
 }
 
-impl<'a> InvalidKeysIter<'a> {
+impl InvalidKeysIter<'_> {
     pub(super) fn new(ptr: gpgme_invalid_key_t, lib: Arc<libloading::Library>) -> Self {
         Self {
             lib,
@@ -181,7 +181,7 @@ impl<'a> InvalidKeysIter<'a> {
     }
 }
 
-impl<'a> Iterator for InvalidKeysIter<'a> {
+impl Iterator for InvalidKeysIter<'_> {
     type Item = InvalidKeyError;
 
     fn next(&mut self) -> Option<Self::Item> {

+ 2 - 8
melib/src/imap/protocol_parser/tests.rs

@@ -158,14 +158,8 @@ fn test_imap_untagged_responses() {
 #[test]
 fn test_imap_fetch_response() {
     #[rustfmt::skip]
-        let input: &[u8] = b"* 198 FETCH (UID 7608 FLAGS (\\Seen) ENVELOPE (\"Fri, 24 Jun 2011 10:09:10 +0000\" \"xxxx/xxxx\" ((\"xx@xx.com\" NIL \"xx\" \"xx.com\")) NIL NIL ((\"xx@xx\" NIL \"xx\" \"xx.com\")) ((\"'xx, xx'\" NIL \"xx.xx\" \"xx.com\")(\"xx.xx@xx.com\" NIL \"xx.xx\" \"xx.com\")(\"'xx'\" NIL \"xx.xx\" \"xx.com\")(\"'xx xx'\" NIL \"xx.xx\" \"xx.com\")(\"xx.xx@xx.com\" NIL \"xx.xx\" \"xx.com\")) NIL NIL \"<xx@xx.com>\") BODY[HEADER.FIELDS (REFERENCES)] {2}\r\n\r\n BODYSTRUCTURE ((\"text\" \"html\" (\"charset\" \"us-ascii\") \"<xx@xx>\" NIL \"7BIT\" 17236 232 NIL NIL NIL NIL)(\"image\" \"jpeg\" (\"name\" \"image001.jpg\") \"<image001.jpg@xx.xx>\" \"image001.jpg\" \"base64\" 1918 NIL (\"inline\" (\"filename\" \"image001.jpg\" \"size\" \"1650\" \"creation-date\" \"Sun, 09 Aug 2015 20:56:04 GMT\" \"modification-date\" \"Sun, 14 Aug 2022 22:11:45 GMT\")) NIL NIL) \"related\" (\"boundary\" \"xx--xx\" \"type\" \"text/html\") NIL \"en-US\"))\r\n";
-    #[rustfmt::skip]
-        //                                                                  ----------------------------------- ------------- --------------------------------------- --- --- ----------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- --- ---------------
-        //                                                                  date                                subject       from                                    |   |   to                                  cc                                                                                                                                                                                                       bcc irt message-id
-        //                                                                                                                                                            |   reply-to
-        //                                                                                                                                                            sender
-
-        let mut address = SmallVec::new();
+    let input: &[u8] = b"* 198 FETCH (UID 7608 FLAGS (\\Seen) ENVELOPE (\"Fri, 24 Jun 2011 10:09:10 +0000\" \"xxxx/xxxx\" ((\"xx@xx.com\" NIL \"xx\" \"xx.com\")) NIL NIL ((\"xx@xx\" NIL \"xx\" \"xx.com\")) ((\"'xx, xx'\" NIL \"xx.xx\" \"xx.com\")(\"xx.xx@xx.com\" NIL \"xx.xx\" \"xx.com\")(\"'xx'\" NIL \"xx.xx\" \"xx.com\")(\"'xx xx'\" NIL \"xx.xx\" \"xx.com\")(\"xx.xx@xx.com\" NIL \"xx.xx\" \"xx.com\")) NIL NIL \"<xx@xx.com>\") BODY[HEADER.FIELDS (REFERENCES)] {2}\r\n\r\n BODYSTRUCTURE ((\"text\" \"html\" (\"charset\" \"us-ascii\") \"<xx@xx>\" NIL \"7BIT\" 17236 232 NIL NIL NIL NIL)(\"image\" \"jpeg\" (\"name\" \"image001.jpg\") \"<image001.jpg@xx.xx>\" \"image001.jpg\" \"base64\" 1918 NIL (\"inline\" (\"filename\" \"image001.jpg\" \"size\" \"1650\" \"creation-date\" \"Sun, 09 Aug 2015 20:56:04 GMT\" \"modification-date\" \"Sun, 14 Aug 2022 22:11:45 GMT\")) NIL NIL) \"related\" (\"boundary\" \"xx--xx\" \"type\" \"text/html\") NIL \"en-US\"))\r\n";
+    let mut address = SmallVec::new();
     address.push(Address::new(None, "xx@xx.com".to_string()));
     let mut env = Envelope::new(EnvelopeHash::default());
     env.set_subject(b"xxxx/xxxx".to_vec());

+ 1 - 1
melib/src/jmap/methods.rs

@@ -774,7 +774,7 @@ impl<'de> ::serde::de::Deserialize<'de> for RequestUrlTemplate {
 
         struct _Visitor;
 
-        impl<'de> Visitor<'de> for _Visitor {
+        impl Visitor<'_> for _Visitor {
             type Value = RequestUrlTemplate;
 
             fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {

+ 1 - 1
melib/src/jmap/submission.rs

@@ -360,7 +360,7 @@ pub struct EnvelopeObject {
     /// submission, plus any parameters to pass with the MAIL FROM
     /// address.  The JMAP server **MAY** allow the address to be the empty
     /// string.
-
+    ///
     /// When a JMAP server performs an SMTP message submission, it MAY
     /// use the same id string for the ENVID parameter `[RFC3461]` and
     /// the [`EmailSubmission`](`EmailSubmissionObject`) object id.  Servers

+ 1 - 1
melib/src/mbox/mod.rs

@@ -738,7 +738,7 @@ pub struct MessageIterator<'a> {
     pub format: Option<MboxFormat>,
 }
 
-impl<'a> Iterator for MessageIterator<'a> {
+impl Iterator for MessageIterator<'_> {
     type Item = Result<Envelope>;
     fn next(&mut self) -> Option<Self::Item> {
         if self.input.is_empty() {

+ 1 - 1
melib/src/nntp/protocol_parser.rs

@@ -33,7 +33,7 @@ pub struct NntpLineIterator<'a> {
     slice: &'a str,
 }
 
-impl<'a> std::iter::DoubleEndedIterator for NntpLineIterator<'a> {
+impl std::iter::DoubleEndedIterator for NntpLineIterator<'_> {
     fn next_back(&mut self) -> Option<Self::Item> {
         if self.slice.is_empty() {
             None

+ 1 - 1
melib/src/text/line_break.rs

@@ -160,7 +160,7 @@ impl EvenAfterSpaces for str {
 ///         .as_slice()
 /// );
 /// ```
-impl<'a> Iterator for LineBreakCandidateIter<'a> {
+impl Iterator for LineBreakCandidateIter<'_> {
     type Item = (usize, LineBreakCandidate);
     fn next(&mut self) -> Option<Self::Item> {
         loop {

+ 1 - 1
melib/src/text/wcwidth.rs

@@ -63,7 +63,7 @@ pub struct CodePointsIterator<'a> {
  * ```
  *
  */
-impl<'a> Iterator for CodePointsIterator<'a> {
+impl Iterator for CodePointsIterator<'_> {
     type Item = WChar;
 
     fn next(&mut self) -> Option<WChar> {

+ 2 - 2
melib/src/thread/iterators.rs

@@ -46,7 +46,7 @@ pub struct ThreadsIterator<'a> {
     pub(super) thread_nodes: &'a HashMap<ThreadNodeHash, ThreadNode>,
 }
 
-impl<'a> Iterator for ThreadsIterator<'a> {
+impl Iterator for ThreadsIterator<'_> {
     type Item = (usize, ThreadNodeHash, bool);
     fn next(&mut self) -> Option<Self::Item> {
         loop {
@@ -99,7 +99,7 @@ pub struct ThreadIterator<'a> {
     pub(super) thread_nodes: &'a HashMap<ThreadNodeHash, ThreadNode>,
 }
 
-impl<'a> Iterator for ThreadIterator<'a> {
+impl Iterator for ThreadIterator<'_> {
     type Item = (usize, ThreadNodeHash);
     fn next(&mut self) -> Option<(usize, ThreadNodeHash)> {
         loop {

+ 1 - 1
melib/src/utils/parsec.rs

@@ -83,7 +83,7 @@ where
 
 impl<'a, F, Output> Parser<'a, Output> for F
 where
-    F: Fn(&'a str) -> Result<Output>,
+    F: Fn(&'a str) -> Result<'a, Output>,
 {
     fn parse(&self, input: &'a str) -> Result<'a, Output> {
         self(input)

+ 2 - 2
melib/src/utils/percent_encoding.rs

@@ -313,7 +313,7 @@ impl<'a> Iterator for PercentEncode<'a> {
     }
 }
 
-impl<'a> std::fmt::Display for PercentEncode<'a> {
+impl std::fmt::Display for PercentEncode<'_> {
     fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         for c in (*self).clone() {
             formatter.write_str(c)?
@@ -395,7 +395,7 @@ fn after_percent_sign(iter: &mut slice::Iter<'_, u8>) -> Option<u8> {
     Some(h as u8 * 0x10 + l as u8)
 }
 
-impl<'a> Iterator for PercentDecode<'a> {
+impl Iterator for PercentDecode<'_> {
     type Item = u8;
 
     fn next(&mut self) -> Option<u8> {

+ 2 - 2
melib/src/utils/urn/mod.rs

@@ -227,7 +227,7 @@ pub struct UrnSlice<'a> {
     q_component_len: Option<NonZeroU32>,
 }
 
-impl<'a> UrnSlice<'a> {
+impl UrnSlice<'_> {
     const fn nid_range(&self) -> Range<usize> {
         // urn:<nid>
         let start = URN_PREFIX.len();
@@ -482,7 +482,7 @@ impl<'a> UrnSlice<'a> {
     }
 }
 
-impl<'a> ToOwned for UrnSlice<'a> {
+impl ToOwned for UrnSlice<'_> {
     type Owned = Urn;
     fn to_owned(&self) -> Self::Owned {
         Urn::from(self)