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

Check fn header along with decl when suggesting to implement trait #5437

Merged
merged 1 commit into from
Apr 8, 2020

Conversation

rabisg0
Copy link
Contributor

@rabisg0 rabisg0 commented Apr 8, 2020

When checking for functions that are potential candidates for trait
implementations check the function header to make sure modifiers like
asyncness, constness and safety match before triggering the lint.

Fixes #5413, #4290

changelog: check fn header along with decl for should_implement_trait

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! NIT in test.

pub struct T1;

impl T1 {
#![allow(clippy::missing_safety_doc)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put this at the top of the file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@flip1995 flip1995 added the S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) label Apr 8, 2020
When checking for functions that are potential candidates for trait
implementations check the function header to make sure modifiers like
asyncness, constness and safety match before triggering the lint.

Fixes rust-lang#5413, rust-lang#4290
@flip1995
Copy link
Member

flip1995 commented Apr 8, 2020

Thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 8, 2020

📌 Commit c2e5534 has been approved by flip1995

@bors
Copy link
Collaborator

bors commented Apr 8, 2020

⌛ Testing commit c2e5534 with merge 940bbd6...

@bors
Copy link
Collaborator

bors commented Apr 8, 2020

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing 940bbd6 to master...

@bors bors merged commit 940bbd6 into rust-lang:master Apr 8, 2020
@rabisg0 rabisg0 deleted the should-impl-trait branch April 8, 2020 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

should_implement_trait does not consider function safety.
3 participants