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

./x.py clippy: allow the most noisy lints #80672

Merged
merged 1 commit into from
Jan 5, 2021

Conversation

matthiaskrgr
Copy link
Member

This silences the following clippy lints in ./x.py clippy:

many_single_char_names (there are a lot of warnings caused by stdarch)
collapsible_if (can reduce readability)
type_complexity
missing_safety_doc (there are almost 3K warnings issued)
too_many_arguments
needless_lifetimes (people want 'tcx lifetimes etc)
wrong_self_convention (warns about from_..(), to_..(), into_..().. fns that do or do not take self by reference.

Just for clarification; this only changes the output of x.py clippy inside the rustc repo and does not change anything about clippy or how cargo clippy is run on peoples crates.

This silences the following clippy lints in ./x.py clippy:

many_single_char_names (there are a lot of warnings caused by stdarch)
collapsible_if (can reduce readability)
type_complexity
missing_safety_doc (there are almost 3K warnings issued)
too_many_arguments
needless_lifetimes (people want 'tcx lifetimes etc)
wrong_self_convention (warns about from_..(), to_..(), into_..().. fns that do or do not take self by reference.
@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 4, 2021
@jyn514 jyn514 added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Jan 4, 2021
@jyn514
Copy link
Member

jyn514 commented Jan 4, 2021

collapsible_if (can reduce readability)

This one surprises me, I can't imagine when I'd want to have if { ... } else { if { ... } }

@matthiaskrgr
Copy link
Member Author

collapsible_if also triggers on

if x {
   if y { }
}

and wants you to
if x && y { ...

@matthiaskrgr
Copy link
Member Author

I tried to split up the lint into two so that we can keep linting the if x {} else { if y {} } case in the future: rust-lang/rust-clippy#6544

@Mark-Simulacrum
Copy link
Member

FWIW, I can see wanting the nested if form - especially with a comment on the nested if in the else block. I also semi-frequently see the pattern of branching on one condition (e.g., something like if stage == 0 in bootstrap, and then the nested if being a special case. I want the structure to communicate that there is special behavior for stage 0, and a general case for all other stages. Under some other conditions the general case has a special case (e.g., maybe a config flag) but it feels better to have it nested - future refactoring would want to otherwise refactor the if into the else.

@Mark-Simulacrum
Copy link
Member

Seems fine to me, I guess, but I don't feel strongly about clippy running in this repo.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 4, 2021

📌 Commit 6a4b24e has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 4, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 5, 2021
Rollup of 12 pull requests

Successful merges:

 - rust-lang#80442 (Mention Arc::make_mut and Rc::make_mut in the documentation of Cow)
 - rust-lang#80533 (bootstrap: clippy fixes)
 - rust-lang#80538 (Add check for `[T;N]`/`usize` mismatch in astconv)
 - rust-lang#80612 (Remove reverted change from relnotes)
 - rust-lang#80627 (Builder: Warn if test file does not exist)
 - rust-lang#80637 (Use Option::filter instead of open-coding it)
 - rust-lang#80643 (Move variable into the only branch where it is relevant)
 - rust-lang#80656 (Fixed documentation error for `std::hint::spin_loop`)
 - rust-lang#80666 (Fix missing link for "fully qualified syntax")
 - rust-lang#80672 (./x.py clippy: allow the most noisy lints)
 - rust-lang#80677 (doc -- list edit for consistency)
 - rust-lang#80696 (make sure that promoteds which fail to evaluate in dead const code behave correctly)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cb43373 into rust-lang:master Jan 5, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 5, 2021
@matthiaskrgr
Copy link
Member Author

I've reduced nesting of if else if conditions in #80793

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants