Closed
Description
Summary
If we have a macro that generates impl
s for something, obviously it may look like like the lifetime is unused inside the macro, but it might be used in the macro callsite.
macro_rules! forward_display_to_print {
($($ty:ty),+) => {
// Some of the $ty arguments may not actually use 'tcx
$(#[allow(unused_lifetimes)] impl<'tcx> fmt::Display for $ty {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ty::tls::with(|tcx| {
let cx = tcx.lift(*self)
.expect("could not lift for printing")
.print(FmtPrinter::new(tcx, Namespace::TypeNS))?;
f.write_str(&cx.into_buffer())?;
Ok(())
})
}
})+
};
}
clippy warns about <'tcx>
here but removing it breaks the code.
Lint Name
extra-unused-lifetimes