The generated Display implementation doesn't explicitly add a lifetime parameter to std::fmt::Formatter, which is recommended by elided_lifetimes_in_paths (which is included in rust_2018_idioms).
Example code
markup::define! {
Example {
span {
"it's an example"
}
}
}
Macro expansion:
pub struct Example {}
impl Example {
#[inline]
#[allow(clippy::inherent_to_string_shadow_display)]
#[allow(unused)]
pub fn to_string(&self) -> String {
let mut string = String::with_capacity(34usize);
let _ = ::markup::Render::render(self, &mut string);
string
}
}
impl ::markup::Render for Example {
fn render(&self, __writer: &mut impl std::fmt::Write) -> std::fmt::Result {
let Example {} = self;
__writer.write_str("<span>it's an example</span>")?;
Ok(())
}
}
impl std::fmt::Display for Example {
#[inline]
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
// ^^^^^^^^^^^^^^^^^^^ clippy complains about a missing lifetime here
::markup::Render::render(self, fmt)
}
}
Possible solutions:
Explicitly allow "elided_lifetimes_in_paths"
```rust
impl std::fmt::Display for Example {
#[inline]
#![allow(elided_lifetimes_in_paths)]
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
::markup::Render::render(self, fmt)
}
}
```
Add the placeholder lifetime
```rust
impl std::fmt::Display for Example {
#[inline]
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
::markup::Render::render(self, fmt)
}
}
```
The generated
Display
implementation doesn't explicitly add a lifetime parameter tostd::fmt::Formatter
, which is recommended byelided_lifetimes_in_paths
(which is included inrust_2018_idioms
).Example code
Macro expansion:
Possible solutions:
Explicitly allow "elided_lifetimes_in_paths"
```rust impl std::fmt::Display for Example { #[inline] #![allow(elided_lifetimes_in_paths)] fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { ::markup::Render::render(self, fmt) } } ```Add the placeholder lifetime
```rust impl std::fmt::Display for Example { #[inline] fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { ::markup::Render::render(self, fmt) } } ```