This issue tracks getting the currently-allow-by-default elided_lifetimes_in_paths lint https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#elided-lifetimes-in-paths into a place where it can be enabled by default.
Context
(This was formerly in the in-band lifetimes tracking issue, #44524, but is being split out because it doesn't actually depend on in-band specifically now that '_ is stable.)
There seems to be general agreement amongst lang that lifetimes that participate in elision should be visible. That means things like
-fn foo<T>(x: &T) -> Foo<T>
+fn foo<T>(x: &T) -> Foo<'_, T>
and
-fn foo<T>(x: Foo<T>, y: Bar<T>) -> &T
+fn foo<T>(x: Foo<'_, T>, y: Bar<T>) -> &T
However, there's less agreement whether they're needed in other places. For example, whether it's valuable to require showing the lifetime in
impl fmt::Debug for StrWrap {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.write_str(self.0)
}
}
A comment against needing that kind of '_: #44524 (comment)
And one saying it's helpful to show it: #44524 (comment)
(If anyone remembers where lang discussed this and has notes about it, please post or edit this comment!)
Perhaps one way to make progress is to start splitting up the lint to isolate the different cases?
Related discussions
Current status
Unresolved questions
This issue tracks getting the currently-allow-by-default
elided_lifetimes_in_pathslint https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#elided-lifetimes-in-paths into a place where it can be enabled by default.Context
(This was formerly in the in-band lifetimes tracking issue, #44524, but is being split out because it doesn't actually depend on in-band specifically now that
'_is stable.)There seems to be general agreement amongst lang that lifetimes that participate in elision should be visible. That means things like
and
However, there's less agreement whether they're needed in other places. For example, whether it's valuable to require showing the lifetime in
impl fmt::Debug for StrWrap { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.write_str(self.0) } }A comment against needing that kind of
'_: #44524 (comment)And one saying it's helpful to show it: #44524 (comment)
(If anyone remembers where lang discussed this and has notes about it, please post or edit this comment!)
Perhaps one way to make progress is to start splitting up the lint to isolate the different cases?
Related discussions
rust_2018_idiomslint is very noisy and results in dramatically degraded APIs for Bevy #131725Current status
elided_lifetimes_in_pathsinto two separate lints under the same lint group: Split elided_lifetime_in_paths into finer-grained lints #120808Unresolved questions