-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unnecessary explicit lifetime bounds. #31742
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
No, I didn't take care of all of the instances found by rust-clippy. |
let mut names = Vec::new(); | ||
|
||
fn collect_mod<'a>(names: &mut Vec<ast::Name>, module: Module<'a>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally leave these kinds of explicit lifetimes around since there's otherwise no way to tell from the signature that Module
is borrowing anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I don't find the code to be any more clear with the explicit lifetimes. What's the concern here? I don't feel strongly, just curious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, actually, in this case it doesn't really help at all. The case I was thinking of was something like fn foo(&self) -> Module
vs fn foo<'a>(&'a self) -> Module<'a>
.
This looks fine except I would prefer to leave in the lifetimes in src/libcore/ptr.rs ; the comment embedded in the instability attribute points out that the lifetime there may be an issue and I would prefer to leave it as a distinct part of the signature for now until that is resolved r=me if you revert that file in the change |
These explicit lifetimes can be ommitted because of lifetime elision rules. Instances were found using rust-clippy.
55e7f05
to
5850d16
Compare
Done |
These explicit lifetimes can be ommitted because of lifetime elision rules. Instances were found using rust-clippy.
These explicit lifetimes can be ommitted because of lifetime elision
rules. Instances were found using rust-clippy.