Skip to content

make noop_method_call warn by default - #111916

Merged
bors merged 3 commits into
rust-lang:masterfrom
fee1-dead-contrib:noop-method-call-warn
Jul 29, 2023
Merged

make noop_method_call warn by default#111916
bors merged 3 commits into
rust-lang:masterfrom
fee1-dead-contrib:noop-method-call-warn

Conversation

@fee1-dead

Copy link
Copy Markdown
Member

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 24, 2023
@rust-log-analyzer

This comment has been minimized.

Comment thread tests/ui/lint/noop-method-call.stderr Outdated

@erikdesjardins erikdesjardins May 24, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This note doesn't really make sense. Vec<i32>::clone also returns the same type it's called on, but that doesn't mean it does nothing. (Alternatively, if you argue that autoref means Vec::new().clone() actually calls clone on &Vec, then clone never returns the type it's called on and the note is still incorrect, because then we're calling clone on &&PlainType<u32>)

I would suggest something like:

Suggested change
= note: the type `&PlainType<u32>` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed
= note: the type `PlainType<u32>` does not implement `Clone`, so calling `clone` on `&PlainType<u32>` clones the reference, which does not do anything and can be removed

@rust-log-analyzer

This comment has been minimized.

@fee1-dead
fee1-dead force-pushed the noop-method-call-warn branch from bd48f32 to 85c4aba Compare May 26, 2023 03:12
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels May 26, 2023
@rust-log-analyzer

This comment has been minimized.

@bors

bors commented May 27, 2023

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #111348) made this pull request unmergeable. Please resolve the merge conflicts.

@fee1-dead
fee1-dead force-pushed the noop-method-call-warn branch from 85c4aba to 7a58b21 Compare May 28, 2023 05:35
@rustbot

rustbot commented May 28, 2023

Copy link
Copy Markdown
Collaborator

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rust-log-analyzer

This comment has been minimized.

@fee1-dead
fee1-dead force-pushed the noop-method-call-warn branch from 7a58b21 to 6c9fb8c Compare May 28, 2023 06:11

@compiler-errors compiler-errors left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does bumping a lint from allow -> warn need an fcp or anything? Implementation looks fine now -- I like the new rewording too.

Comment thread compiler/rustc_lint/src/noop_method_call.rs Outdated
@fee1-dead
fee1-dead force-pushed the noop-method-call-warn branch from 6c9fb8c to 6fd5a06 Compare May 29, 2023 14:09
@fee1-dead

Copy link
Copy Markdown
Member Author

Not sure about whether a fcp is needed.

cc @rust-lang/compiler-contributors

@RalfJung

Copy link
Copy Markdown
Member

cc @rust-lang/compiler-contributors

(That's a huge ping group with more than 40 people, most of whom do not have FCP power. It's probably not what you wanted to ping here.)

@fee1-dead

Copy link
Copy Markdown
Member Author

It's the group that gets pinged for MCPs so I pinged.

@oli-obk

oli-obk commented May 30, 2023

Copy link
Copy Markdown
Contributor

This lint was made allow-by-default in the original PR, but there was never the proposed follow up to make it warn-by-default. I think it was mostly allow-by-default to make it easier for clippy to transition?

This implemented the lint proposed in the following lang-team MCP: rust-lang/lang-team#67

The lang team would like to see a crater run with this lint denied to judge its effects on existing code.

@fee1-dead

Copy link
Copy Markdown
Member Author

experiment PR now up at #112160

@compiler-errors compiler-errors added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 5, 2023
@fee1-dead

Copy link
Copy Markdown
Member Author

experiment completed. Should I add a suggestion to the diagnostic?

@fee1-dead

fee1-dead commented Jun 7, 2023

Copy link
Copy Markdown
Member Author

Marking as S-waiting-on(-lang)-team

@fee1-dead fee1-dead added T-lang Relevant to the language team S-waiting-on-team and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Jun 7, 2023
@oli-obk

oli-obk commented Jun 8, 2023

Copy link
Copy Markdown
Contributor

experiment completed. Should I add a suggestion to the diagnostic?

Please summarize the crater results. You can then add the lang team nominated label so their triage picks it up

@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Jul 23, 2023
@fee1-dead fee1-dead removed the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Jul 23, 2023
@fee1-dead

Copy link
Copy Markdown
Member Author

I have added a suggestion.

@fee1-dead fee1-dead added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Jul 23, 2023
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Jul 28, 2023
@rfcbot

rfcbot commented Jul 28, 2023

Copy link
Copy Markdown

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@compiler-errors

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jul 28, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit 2a76c57 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 28, 2023
@bors

bors commented Jul 29, 2023

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 2a76c57 with merge 4734ac0...

@bors

bors commented Jul 29, 2023

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing 4734ac0 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 29, 2023
@bors
bors merged commit 4734ac0 into rust-lang:master Jul 29, 2023
@rustbot rustbot added this to the 1.73.0 milestone Jul 29, 2023
@fee1-dead
fee1-dead deleted the noop-method-call-warn branch July 29, 2023 06:56
@fee1-dead fee1-dead added relnotes Marks issues that should be documented in the release notes of the next release. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-fcp Status: PR is in FCP and is awaiting for FCP to complete. labels Jul 29, 2023
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (4734ac0): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.9% [3.9%, 3.9%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.7% [-0.6%, 3.9%] 2

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 651.453s -> 650.829s (-0.10%)

@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Aug 4, 2023
@apiraino apiraino removed the I-lang-nominated Nominated for discussion during a lang team meeting. label Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-testsuite Area: The testsuite used to check the correctness of rustc disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. merged-by-bors This PR was explicitly merged by bors. relnotes Marks issues that should be documented in the release notes of the next release. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-lang Relevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.