Skip to content

Run internal lints on the Clippy code base #3166

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

Merged
merged 3 commits into from
Sep 13, 2018

Conversation

flip1995
Copy link
Member

We never ran the internal lints on the Clippy codebase in CI.

I added them to travis and fixed the upcoming error messages.

@phansch

@ghost
Copy link

ghost commented Sep 12, 2018

Shouldn't clippy::pedantic be turned on as well?

@flip1995
Copy link
Member Author

We can try it, but I'm not sure if we want all the pedantic lints turned on for the whole clippy codebase. That would probably cause a lot of allows everywhere.

I'll try it later

@flip1995
Copy link
Member Author

flip1995 commented Sep 12, 2018

It produced 70 warnings. Travis

warnings
warning: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
--> rustc_tools_util/src/lib.rs:43:9

warning: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
--> rustc_tools_util/src/lib.rs:71:9

warning: unnecessary structure name repetition
--> clippy_dev/src/lib.rs:41:97

warning: unnecessary structure name repetition
--> clippy_dev/src/lib.rs:42:9

warning: unnecessary structure name repetition
--> clippy_dev/src/lib.rs:52:34

warning: unnecessary structure name repetition
--> clippy_dev/src/lib.rs:57:35

warning: unnecessary structure name repetition
--> clippy_dev/src/lib.rs:57:65

warning: binding's name is too similar to existing binding
--> clippy_lints/src/utils/hir_utils.rs:111:92

warning: binding's name is too similar to existing binding
--> clippy_lints/src/utils/hir_utils.rs:123:82

warning: binding's name is too similar to existing binding
--> clippy_lints/src/utils/hir_utils.rs:203:73

warning: binding's name is too similar to existing binding
--> clippy_lints/src/utils/hir_utils.rs:206:80

warning: binding's name is too similar to existing binding
--> clippy_lints/src/utils/hir_utils.rs:206:89

warning: binding's name is too similar to existing binding
--> clippy_lints/src/utils/hir_utils.rs:258:76

warning: binding's name is too similar to existing binding
--> clippy_lints/src/utils/inspector.rs:273:37

warning: binding's name is too similar to existing binding
--> clippy_lints/src/utils/inspector.rs:422:44

warning: binding's name is too similar to existing binding
--> clippy_lints/src/utils/usage.rs:58:39

warning: binding's name is too similar to existing binding
--> clippy_lints/src/double_comparison.rs:50:33

warning: binding's name is too similar to existing binding
--> clippy_lints/src/enum_clike.rs:59:25

warning: binding's name is too similar to existing binding
--> clippy_lints/src/enum_variants.rs:268:29

warning: binding's name is too similar to existing binding
--> clippy_lints/src/eq_op.rs:93:29

warning: binding's name is too similar to existing binding
--> clippy_lints/src/eq_op.rs:95:29

warning: binding's name is too similar to existing binding
--> clippy_lints/src/eq_op.rs:105:41

warning: binding's name is too similar to existing binding
--> clippy_lints/src/if_let_redundant_pattern_matching.rs:52:56

warning: binding's name is too similar to existing binding
--> clippy_lints/src/transmute.rs:291:42

warning: adding items after statements is confusing, since items exist from the start of the scope
--> clippy_lints/src/consts.rs:282:17

warning: item name starts with its containing module's name
--> clippy_lints/src/utils/camel_case.rs:3:1

warning: item name starts with its containing module's name
--> clippy_lints/src/utils/camel_case.rs:36:1

warning: adding items after statements is confusing, since items exist from the start of the scope
--> clippy_lints/src/utils/higher.rs:80:5

warning: item name starts with its containing module's name
--> clippy_lints/src/double_comparison.rs:33:1

warning: you should put `1_000_000_000.0` between ticks in the documentation
--> clippy_lints/src/excessive_precision.rs:102:8

warning: you should put `var_arg` between ticks in the documentation
--> clippy_lints/src/map_unit_fn.rs:172:49

warning: adding items after statements is confusing, since items exist from the start of the scope
[--> clippy_lints/src/methods.rs:1050:9

warning: adding items after statements is confusing, since items exist from the start of the scope
[--> clippy_lints/src/methods.rs:1288:5

warning: item name starts with its containing module's name
--> clippy_lints/src/question_mark.rs:37:1

warning: adding items after statements is confusing, since items exist from the start of the scope
--> clippy_lints/src/write.rs:267:5

warning: adding items after statements is confusing, since items exist from the start of the scope
--> clippy_lints/src/write.rs:293:9

warning: unnecessary structure name repetition
--> clippy_lints/src/consts.rs:126:33

warning: unnecessary structure name repetition
--> clippy_lints/src/consts.rs:130:23

warning: casting u128 to i128 may wrap around the value
--> clippy_lints/src/consts.rs:229:63

warning: casting u128 to u32 may truncate the value
--> clippy_lints/src/consts.rs:332:61

warning: casting i128 to u128 may lose the sign of the value
--> clippy_lints/src/consts.rs:332:61

warning: casting u128 to u32 may truncate the value
--> clippy_lints/src/consts.rs:333:61

warning: casting i128 to u128 may lose the sign of the value
--> clippy_lints/src/consts.rs:333:61

warning: casting u128 to u32 may truncate the value
--> clippy_lints/src/consts.rs:353:61

warning: casting u128 to u32 may truncate the value
--> clippy_lints/src/consts.rs:354:61

warning: casting u128 to u32 may truncate the value
--> clippy_lints/src/consts.rs:417:74

warning: casting u128 to u64 may truncate the value
--> clippy_lints/src/consts.rs:418:74

warning: casting u64 to usize may truncate the value on targets with 32-bit wide pointers
--> clippy_lints/src/consts.rs:431:34

warning: unnecessary structure name repetition
--> clippy_lints/src/utils/conf.rs:151:21

warning: casting usize to u32 may truncate the value on targets with 64-bit wide pointers
--> clippy_lints/src/utils/sugg.rs:533:78

warning: casting u128 to i128 may wrap around the value
--> clippy_lints/src/utils/mod.rs:976:6

warning: casting i128 to u128 may lose the sign of the value
--> clippy_lints/src/utils/mod.rs:982:6

warning: this `match` has identical arm bodies
--> clippy_lints/src/duration_subsec.rs:51:52

warning: casting u128 to i128 may wrap around the value
--> clippy_lints/src/enum_clike.rs:73:44

warning: unnecessary structure name repetition
--> clippy_lints/src/inherent_impl.rs:49:9

warning: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.filter_map(..)` instead.
--> clippy_lints/src/inherent_impl.rs:78:38

warning: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
--> clippy_lints/src/multiple_crate_versions.rs:44:24

warning: casting usize to u32 may truncate the value on targets with 64-bit wide pointers
--> clippy_lints/src/regex.rs:136:35

warning: casting usize to u32 may truncate the value on targets with 64-bit wide pointers
--> clippy_lints/src/regex.rs:137:37

warning: casting isize to i32 may truncate the value on targets with 64-bit wide pointers
--> src/driver.rs:18:10

warning: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.filter_map(..)` instead.
--> src/driver.rs:79:21

warning: casting isize to i32 may truncate the value on targets with 64-bit wide pointers
--> src/driver.rs:18:10

warning: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.filter_map(..)` instead.
--> src/driver.rs:79:21

Some of them can be fixed I guess, but most of them need an #[allow(..)]

@phansch
Copy link
Member

phansch commented Sep 13, 2018

This looks nice! Since it's 70 warnings, I think it makes more sense to open a new issue for enabling clippy::pedantic.

@@ -1,3 +1,5 @@
#![feature(tool_lints)]
#![allow(clippy::default_hash_types)]
Copy link
Member Author

Choose a reason for hiding this comment

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

@phansch in clippy_dev the feature rustc_private isn't activated, because no use rustc::... is used. That means that also FxHashMap cannot be used.

I think disabling the Lint here is better than adding the #![feature(rustc_private)]. What's your opinion on this?

Copy link
Member

Choose a reason for hiding this comment

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

Yea we can just disable the lint there. I don't think we will need any rustc::... in clippy_dev in the near future.

@flip1995
Copy link
Member Author

I removed the pedantic lint group from Travis again. I think this can be merged now.

@phansch phansch merged commit 07cb45b into rust-lang:master Sep 13, 2018
@flip1995 flip1995 deleted the travis_internal branch September 13, 2018 16:33
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.

2 participants