Skip to content
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

Merged
merged 1 commit into from
Feb 19, 2016

Conversation

frewsxcv
Copy link
Member

These explicit lifetimes can be ommitted because of lifetime elision
rules. Instances were found using rust-clippy.

@rust-highfive
Copy link
Contributor

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.

@frewsxcv
Copy link
Member Author

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>) {
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

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>.

@pnkfelix
Copy link
Member

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.
@frewsxcv
Copy link
Member Author

This looks fine except I would prefer to leave in the lifetimes in src/libcore/ptr.rs

Done

@alexcrichton
Copy link
Member

@bors: r=pnkfelix 5850d16

@bors
Copy link
Collaborator

bors commented Feb 19, 2016

⌛ Testing commit 5850d16 with merge 28a3e8b...

bors added a commit that referenced this pull request Feb 19, 2016
These explicit lifetimes can be ommitted because of lifetime elision
rules. Instances were found using rust-clippy.
@bors bors merged commit 5850d16 into rust-lang:master Feb 19, 2016
@frewsxcv frewsxcv deleted the needless-lifetimes branch February 19, 2016 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants