Description
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
- PR to split up
elided_lifetimes_in_paths
into two separate lints under the same lint group: Split elided_lifetime_in_paths into tied and untied #120808
Unresolved questions
- For Split elided_lifetime_in_paths into tied and untied #120808, what should the split-up lints be called, i.e. are "tied" vs "untied" terminology sufficiently clear?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status