Skip to content

Commit

Permalink
Fix Clippy needless_lifetimes warning
Browse files Browse the repository at this point in the history
  • Loading branch information
lambda-fairy committed Oct 5, 2024
1 parent 0254fe1 commit c9a81e8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/src/string_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize> {
str::from_utf8(buf)
.map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err))
Expand Down
6 changes: 3 additions & 3 deletions docs/src/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -105,7 +105,7 @@ impl<'a> Render for Comrak<'a> {
/// extra `<p>` 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();
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion maud/benches/complicated_maud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
12 changes: 6 additions & 6 deletions maud/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down Expand Up @@ -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<T: Render + ?Sized> 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<T: Render + ?Sized> Render for &mut T {
fn render_to(&self, w: &mut String) {
T::render_to(self, w);
}
Expand Down Expand Up @@ -290,7 +290,7 @@ mod rocket_support {
};
use std::io::Cursor;

impl<'r> Responder<'r, 'static> for PreEscaped<String> {
impl Responder<'_, 'static> for PreEscaped<String> {
fn respond_to(self, _: &Request) -> rocket::response::Result<'static> {
Response::build()
.header(ContentType::HTML)
Expand Down

0 comments on commit c9a81e8

Please sign in to comment.