From c9a81e88621260fc381b512af6e260e22e4a6e27 Mon Sep 17 00:00:00 2001 From: Chris Wong Date: Sat, 5 Oct 2024 13:06:22 +1000 Subject: [PATCH] Fix Clippy `needless_lifetimes` warning --- docs/src/string_writer.rs | 2 +- docs/src/views.rs | 6 +++--- maud/benches/complicated_maud.rs | 2 +- maud/src/lib.rs | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/src/string_writer.rs b/docs/src/string_writer.rs index ea7291ab..2b71cfa8 100644 --- a/docs/src/string_writer.rs +++ b/docs/src/string_writer.rs @@ -2,7 +2,7 @@ use std::{io, str}; pub struct StringWriter<'a>(pub &'a mut String); -impl<'a> io::Write for StringWriter<'a> { +impl io::Write for StringWriter<'_> { fn write(&mut self, buf: &[u8]) -> io::Result { str::from_utf8(buf) .map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err)) diff --git a/docs/src/views.rs b/docs/src/views.rs index 7f21efd7..9b550054 100644 --- a/docs/src/views.rs +++ b/docs/src/views.rs @@ -88,7 +88,7 @@ pub fn main<'a>( struct Comrak<'a>(&'a AstNode<'a>); -impl<'a> Render for Comrak<'a> { +impl Render for Comrak<'_> { fn render_to(&self, buffer: &mut String) { let highlighter = Highlighter::get(); comrak::format_html_with_plugins( @@ -105,7 +105,7 @@ impl<'a> Render for Comrak<'a> { /// extra `

` tag that we don't want most of the time. struct ComrakRemovePTags<'a>(&'a AstNode<'a>); -impl<'a> Render for ComrakRemovePTags<'a> { +impl Render for ComrakRemovePTags<'_> { fn render(&self) -> Markup { let mut buffer = String::new(); let highlighter = Highlighter::get(); @@ -128,7 +128,7 @@ impl<'a> Render for ComrakRemovePTags<'a> { struct ComrakText<'a>(&'a AstNode<'a>); -impl<'a> Render for ComrakText<'a> { +impl Render for ComrakText<'_> { fn render_to(&self, buffer: &mut String) { comrak::format_commonmark(self.0, &default_comrak_options(), &mut StringWriter(buffer)) .unwrap(); diff --git a/maud/benches/complicated_maud.rs b/maud/benches/complicated_maud.rs index 6e0e45dd..7dd9ead7 100644 --- a/maud/benches/complicated_maud.rs +++ b/maud/benches/complicated_maud.rs @@ -41,7 +41,7 @@ mod btn { } } - impl<'a> Render for Button<'a> { + impl Render for Button<'_> { fn render(&self) -> Markup { match self.req_meth { RequestMethod::Get => { diff --git a/maud/src/lib.rs b/maud/src/lib.rs index beaaea23..7647379c 100644 --- a/maud/src/lib.rs +++ b/maud/src/lib.rs @@ -50,7 +50,7 @@ impl<'a> Escaper<'a> { } } -impl<'a> fmt::Write for Escaper<'a> { +impl fmt::Write for Escaper<'_> { fn write_str(&mut self, s: &str) -> fmt::Result { escape::escape_to_string(s, self.0); Ok(()) @@ -120,25 +120,25 @@ impl Render for String { } } -impl<'a> Render for Cow<'a, str> { +impl Render for Cow<'_, str> { fn render_to(&self, w: &mut String) { str::render_to(self, w); } } -impl<'a> Render for Arguments<'a> { +impl Render for Arguments<'_> { fn render_to(&self, w: &mut String) { let _ = Escaper::new(w).write_fmt(*self); } } -impl<'a, T: Render + ?Sized> Render for &'a T { +impl Render for &T { fn render_to(&self, w: &mut String) { T::render_to(self, w); } } -impl<'a, T: Render + ?Sized> Render for &'a mut T { +impl Render for &mut T { fn render_to(&self, w: &mut String) { T::render_to(self, w); } @@ -290,7 +290,7 @@ mod rocket_support { }; use std::io::Cursor; - impl<'r> Responder<'r, 'static> for PreEscaped { + impl Responder<'_, 'static> for PreEscaped { fn respond_to(self, _: &Request) -> rocket::response::Result<'static> { Response::build() .header(ContentType::HTML)