conlang: Elide lifetimes (fixes clippy lint)
This commit is contained in:
		| @@ -21,7 +21,7 @@ pub struct Indent<'f, F: Write + ?Sized> { | |||||||
|     f: &'f mut F, |     f: &'f mut F, | ||||||
| } | } | ||||||
|  |  | ||||||
| impl<'f, F: Write + ?Sized> Write for Indent<'f, F> { | impl<F: Write + ?Sized> Write for Indent<'_, F> { | ||||||
|     fn write_str(&mut self, s: &str) -> std::fmt::Result { |     fn write_str(&mut self, s: &str) -> std::fmt::Result { | ||||||
|         for s in s.split_inclusive('\n') { |         for s in s.split_inclusive('\n') { | ||||||
|             self.f.write_str(s)?; |             self.f.write_str(s)?; | ||||||
| @@ -45,14 +45,14 @@ impl<'f, F: Write + ?Sized> Delimit<'f, F> { | |||||||
|         Self { f, delim } |         Self { f, delim } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| impl<'f, F: Write + ?Sized> Drop for Delimit<'f, F> { | impl<F: Write + ?Sized> Drop for Delimit<'_, F> { | ||||||
|     fn drop(&mut self) { |     fn drop(&mut self) { | ||||||
|         let Self { f: Indent { f, .. }, delim } = self; |         let Self { f: Indent { f, .. }, delim } = self; | ||||||
|         let _ = f.write_str(delim.close); |         let _ = f.write_str(delim.close); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| impl<'f, F: Write + ?Sized> Write for Delimit<'f, F> { | impl<F: Write + ?Sized> Write for Delimit<'_, F> { | ||||||
|     fn write_str(&mut self, s: &str) -> std::fmt::Result { |     fn write_str(&mut self, s: &str) -> std::fmt::Result { | ||||||
|         self.f.write_str(s) |         self.f.write_str(s) | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -147,18 +147,18 @@ impl<'scope> Frame<'scope> { | |||||||
|         Self { scope: scope.enter(name) } |         Self { scope: scope.enter(name) } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| impl<'scope> Deref for Frame<'scope> { | impl Deref for Frame<'_> { | ||||||
|     type Target = Environment; |     type Target = Environment; | ||||||
|     fn deref(&self) -> &Self::Target { |     fn deref(&self) -> &Self::Target { | ||||||
|         self.scope |         self.scope | ||||||
|     } |     } | ||||||
| } | } | ||||||
| impl<'scope> DerefMut for Frame<'scope> { | impl DerefMut for Frame<'_> { | ||||||
|     fn deref_mut(&mut self) -> &mut Self::Target { |     fn deref_mut(&mut self) -> &mut Self::Target { | ||||||
|         self.scope |         self.scope | ||||||
|     } |     } | ||||||
| } | } | ||||||
| impl<'scope> Drop for Frame<'scope> { | impl Drop for Frame<'_> { | ||||||
|     fn drop(&mut self) { |     fn drop(&mut self) { | ||||||
|         self.scope.exit(); |         self.scope.exit(); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ pub mod lexer_iter { | |||||||
|     pub struct LexerIter<'t> { |     pub struct LexerIter<'t> { | ||||||
|         lexer: Lexer<'t>, |         lexer: Lexer<'t>, | ||||||
|     } |     } | ||||||
|     impl<'t> Iterator for LexerIter<'t> { |     impl Iterator for LexerIter<'_> { | ||||||
|         type Item = LResult<Token>; |         type Item = LResult<Token>; | ||||||
|         fn next(&mut self) -> Option<Self::Item> { |         fn next(&mut self) -> Option<Self::Item> { | ||||||
|             match self.lexer.scan() { |             match self.lexer.scan() { | ||||||
| @@ -192,7 +192,7 @@ impl<'t> Lexer<'t> { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| /// Digraphs and trigraphs | /// Digraphs and trigraphs | ||||||
| impl<'t> Lexer<'t> { | impl Lexer<'_> { | ||||||
|     fn amp(&mut self) -> LResult<Token> { |     fn amp(&mut self) -> LResult<Token> { | ||||||
|         match self.peek() { |         match self.peek() { | ||||||
|             Ok('&') => self.consume()?.produce_op(Kind::AmpAmp), |             Ok('&') => self.consume()?.produce_op(Kind::AmpAmp), | ||||||
| @@ -319,7 +319,7 @@ impl<'t> Lexer<'t> { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| /// Comments | /// Comments | ||||||
| impl<'t> Lexer<'t> { | impl Lexer<'_> { | ||||||
|     fn line_comment(&mut self) -> LResult<Token> { |     fn line_comment(&mut self) -> LResult<Token> { | ||||||
|         let mut comment = String::new(); |         let mut comment = String::new(); | ||||||
|         while Ok('\n') != self.peek() { |         while Ok('\n') != self.peek() { | ||||||
| @@ -339,7 +339,7 @@ impl<'t> Lexer<'t> { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| /// Identifiers | /// Identifiers | ||||||
| impl<'t> Lexer<'t> { | impl Lexer<'_> { | ||||||
|     fn identifier(&mut self) -> LResult<Token> { |     fn identifier(&mut self) -> LResult<Token> { | ||||||
|         let mut out = String::from(self.xid_start()?); |         let mut out = String::from(self.xid_start()?); | ||||||
|         while let Ok(c) = self.xid_continue() { |         while let Ok(c) = self.xid_continue() { | ||||||
| @@ -371,7 +371,7 @@ impl<'t> Lexer<'t> { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| /// Integers | /// Integers | ||||||
| impl<'t> Lexer<'t> { | impl Lexer<'_> { | ||||||
|     fn int_with_base(&mut self) -> LResult<Token> { |     fn int_with_base(&mut self) -> LResult<Token> { | ||||||
|         match self.peek() { |         match self.peek() { | ||||||
|             Ok('x') => self.consume()?.digits::<16>(), |             Ok('x') => self.consume()?.digits::<16>(), | ||||||
| @@ -414,7 +414,7 @@ impl<'t> Lexer<'t> { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| /// Strings and characters | /// Strings and characters | ||||||
| impl<'t> Lexer<'t> { | impl Lexer<'_> { | ||||||
|     fn string(&mut self) -> LResult<Token> { |     fn string(&mut self) -> LResult<Token> { | ||||||
|         let mut value = String::new(); |         let mut value = String::new(); | ||||||
|         while '"' |         while '"' | ||||||
|   | |||||||
| @@ -120,19 +120,19 @@ pub mod yamler { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     impl<'y> Deref for Section<'y> { |     impl Deref for Section<'_> { | ||||||
|         type Target = Yamler; |         type Target = Yamler; | ||||||
|         fn deref(&self) -> &Self::Target { |         fn deref(&self) -> &Self::Target { | ||||||
|             self.yamler |             self.yamler | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     impl<'y> DerefMut for Section<'y> { |     impl DerefMut for Section<'_> { | ||||||
|         fn deref_mut(&mut self) -> &mut Self::Target { |         fn deref_mut(&mut self) -> &mut Self::Target { | ||||||
|             self.yamler |             self.yamler | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     impl<'y> Drop for Section<'y> { |     impl Drop for Section<'_> { | ||||||
|         fn drop(&mut self) { |         fn drop(&mut self) { | ||||||
|             let Self { yamler } = self; |             let Self { yamler } = self; | ||||||
|             yamler.decrease(); |             yamler.decrease(); | ||||||
|   | |||||||
| @@ -37,7 +37,7 @@ pub mod interned { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     impl<'a, T: ?Sized + Debug> Debug for Interned<'a, T> { |     impl<T: ?Sized + Debug> Debug for Interned<'_, T> { | ||||||
|         fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |         fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||||||
|             f.debug_struct("Interned") |             f.debug_struct("Interned") | ||||||
|                 .field("value", &self.value) |                 .field("value", &self.value) | ||||||
| @@ -49,14 +49,14 @@ pub mod interned { | |||||||
|             Self { value } |             Self { value } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     impl<'a, T: ?Sized> Deref for Interned<'a, T> { |     impl<T: ?Sized> Deref for Interned<'_, T> { | ||||||
|         type Target = T; |         type Target = T; | ||||||
|         fn deref(&self) -> &Self::Target { |         fn deref(&self) -> &Self::Target { | ||||||
|             self.value |             self.value | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     impl<'a, T: ?Sized> Copy for Interned<'a, T> {} |     impl<T: ?Sized> Copy for Interned<'_, T> {} | ||||||
|     impl<'a, T: ?Sized> Clone for Interned<'a, T> { |     impl<T: ?Sized> Clone for Interned<'_, T> { | ||||||
|         fn clone(&self) -> Self { |         fn clone(&self) -> Self { | ||||||
|             *self |             *self | ||||||
|         } |         } | ||||||
| @@ -79,13 +79,13 @@ pub mod interned { | |||||||
|     //     } |     //     } | ||||||
|     // } |     // } | ||||||
|  |  | ||||||
|     impl<'a, T: ?Sized> Eq for Interned<'a, T> {} |     impl<T: ?Sized> Eq for Interned<'_, T> {} | ||||||
|     impl<'a, T: ?Sized> PartialEq for Interned<'a, T> { |     impl<T: ?Sized> PartialEq for Interned<'_, T> { | ||||||
|         fn eq(&self, other: &Self) -> bool { |         fn eq(&self, other: &Self) -> bool { | ||||||
|             std::ptr::eq(self.value, other.value) |             std::ptr::eq(self.value, other.value) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     impl<'a, T: ?Sized> Hash for Interned<'a, T> { |     impl<T: ?Sized> Hash for Interned<'_, T> { | ||||||
|         fn hash<H: std::hash::Hasher>(&self, state: &mut H) { |         fn hash<H: std::hash::Hasher>(&self, state: &mut H) { | ||||||
|             Self::as_ptr(self).hash(state) |             Self::as_ptr(self).hash(state) | ||||||
|         } |         } | ||||||
| @@ -208,8 +208,8 @@ pub mod string_interner { | |||||||
|     // This is fine because StringInterner::get_or_insert(v) holds a RwLock |     // This is fine because StringInterner::get_or_insert(v) holds a RwLock | ||||||
|     // for its entire duration, and doesn't touch the non-(Send+Sync) arena |     // for its entire duration, and doesn't touch the non-(Send+Sync) arena | ||||||
|     // unless the lock is held by a write guard. |     // unless the lock is held by a write guard. | ||||||
|     unsafe impl<'a> Send for StringInterner<'a> {} |     unsafe impl Send for StringInterner<'_> {} | ||||||
|     unsafe impl<'a> Sync for StringInterner<'a> {} |     unsafe impl Sync for StringInterner<'_> {} | ||||||
|  |  | ||||||
|     #[cfg(test)] |     #[cfg(test)] | ||||||
|     mod tests { |     mod tests { | ||||||
| @@ -306,5 +306,5 @@ pub mod typed_interner { | |||||||
|     /// [get_or_insert](TypedInterner::get_or_insert) are unique, and the function uses |     /// [get_or_insert](TypedInterner::get_or_insert) are unique, and the function uses | ||||||
|     /// the [RwLock] around the [HashSet] to ensure mutual exclusion |     /// the [RwLock] around the [HashSet] to ensure mutual exclusion | ||||||
|     unsafe impl<'a, T: Eq + Hash + Send> Send for TypedInterner<'a, T> where &'a T: Send {} |     unsafe impl<'a, T: Eq + Hash + Send> Send for TypedInterner<'a, T> where &'a T: Send {} | ||||||
|     unsafe impl<'a, T: Eq + Hash + Send + Sync> Sync for TypedInterner<'a, T> {} |     unsafe impl<T: Eq + Hash + Send + Sync> Sync for TypedInterner<'_, T> {} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ pub enum Source<'a> { | |||||||
|     Ty(&'a TyKind), |     Ty(&'a TyKind), | ||||||
| } | } | ||||||
|  |  | ||||||
| impl<'a> Source<'a> { | impl Source<'_> { | ||||||
|     pub fn name(&self) -> Option<Sym> { |     pub fn name(&self) -> Option<Sym> { | ||||||
|         match self { |         match self { | ||||||
|             Source::Root => None, |             Source::Root => None, | ||||||
|   | |||||||
| @@ -268,7 +268,7 @@ impl<'a> Table<'a> { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| impl<'a> Default for Table<'a> { | impl Default for Table<'_> { | ||||||
|     fn default() -> Self { |     fn default() -> Self { | ||||||
|         Self::new() |         Self::new() | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user