Commit Graph

1228 Commits

Author SHA1 Message Date
Philipp Krones 935b45db61 Rollup merge of #5409 - dtolnay:letunit, r=flip1995
Downgrade let_unit_value to pedantic

Given that the false positive in #1502 is marked E-hard and I don't have much hope of it getting fixed, I think it would be wise to disable this lint by default. I have had to suppress this lint in every substantial codebase (\>100k line) I have worked in. Any time this lint is being triggered, it's always the false positive case.

The motivation for this lint is documented as:

> A unit value cannot usefully be used anywhere. So binding one is kind of pointless.

with this example:

> ```rust
> let x = {
>     1;
> };
> ```

Sure, but the author would find this out via an unused_variable warning or from `x` not being the type that they need further down. If there ends up being a type error on `x`, clippy's advice isn't going to help get the code compiling because it can only run if the code already compiles.

changelog: Remove let_unit_value from default set of enabled lints
2020-04-08 15:50:16 +02:00
Linus Färnstrand 51bb1d28c5 Use assoc const NAN for zero_div_zero lint 2020-04-08 00:43:27 +02:00
David Tolnay adcaa1b86d Downgrade let_unit_value to pedantic 2020-04-02 18:31:31 -07:00
Jacek Pospychala f8e892db5e useless Rc<Rc<T>>, Rc<Box<T>>, Rc<&T>, Box<&T> 2020-04-02 00:02:25 +02:00
David Tolnay 86b0dd4197 Downgrade option_option to pedantic 2020-04-01 12:00:49 -07:00
flip1995 3155eedb68 Don't use an exact lint counter anymore 2020-03-31 17:24:09 +02:00
Tomasz Miąsko b77b219280 Lint unnamed address comparisons 2020-03-30 21:42:16 +02:00
Matthias Krüger aff57e0f43 rustup https://github.com/rust-lang/rust/pull/70536 2020-03-30 11:17:58 +02:00
Lzu Tao d055b7d61c Deprecate REPLACE_CONSTS lint 2020-03-29 12:59:35 +07:00
flip1995 7a40b5c132 Move verbose_file_reads to restriction 2020-03-26 15:01:03 +01:00
Matthias Krüger b86e8434df move redundant_pub_crate to nursery
cc #5369
2020-03-25 18:14:11 +01:00
bors 100a24d9d8 Auto merge of #5364 - flip1995:useless_transmute_quarantine, r=Manishearth
Move useless_transmute to nursery

cc #5343

@rust-lang/clippy anyone against moving this to nursery?

changelog: Move [`useless_transmute`] to nursery
2020-03-23 20:52:57 +00:00
flip1995 13fcee51e7 Move useless_transmute to nursery 2020-03-23 20:32:04 +01:00
Tim Robinson 870b9e8139 nursery group -> style 2020-03-23 16:45:31 +00:00
Tim Robinson 52208f3cf3 Lint for pub(crate) items that are not crate visible due to the visibility of the module that contains them
Closes #5274.
2020-03-16 12:21:00 +00:00
Jacob Meyers 0f7f30711e add lint on File::read_to_string and File::read_to_end 2020-03-06 09:50:49 -05:00
flip1995 57393b5106 Rename macro_use_import -> macro_use_imports 2020-03-05 19:22:17 +01:00
Devin R 597e02dcdf warn on macro_use attr 2020-03-04 09:36:02 -05:00
ThibsG 2aa14c9beb Add restrictive pat use in full binded struct 2020-03-04 09:11:07 +01:00
Krishna Sai Veera Reddy ff0d44e45a Add imprecise_flops lint
Add lint to detect floating point operations that can be computed more
accurately at the cost of performance. `cbrt`, `ln_1p` and `exp_m1`
library functions call their equivalent cmath implementations which is
slower but more accurate so moving checks for these under this new lint.
2020-02-23 22:36:15 -08:00
Krishna Sai Veera Reddy 4065ca9c8c Move manual_mul_add into suboptimal_flops lint 2020-02-23 22:20:34 -08:00
Krishna Sai Veera Reddy 6dacb1aa67 Change lint name to suboptimal_flops 2020-02-23 22:20:34 -08:00
Krishna Veera Reddy 1f4f357bf5 Consolidate the accuracy and efficiency lints
Merge the accuracy and efficiency lints into a single lint that
checks for improvements to accuracy, efficiency and readability
of floating-point expressions.
2020-02-23 22:20:33 -08:00
Krishna Veera Reddy c636c6a55b Add lints to detect inaccurate and inefficient FP operations
Add lints to detect floating point computations that are either
inaccurate or inefficient and suggest better alternatives.
2020-02-23 22:20:33 -08:00
flip1995 8472ecda0f Fix fallout 2020-02-21 11:14:18 +01:00
flip1995 06a6189376 Move enum_glob_use lint into wildcard_imports pass 2020-02-21 11:14:17 +01:00
flip1995 4229dbcf33 Run update_lints 2020-02-21 11:14:16 +01:00
bors acfcbee4a2 Auto merge of #5202 - krishna-veerareddy:issue-5201-move-lossy-float-literal-restriction, r=flip1995
Move check for lossy whole-number floats out of `excessive_precision`

changelog: Add new lint `lossy_float_literal` to detect lossy whole number float literals and move it out of `excessive_precision` again.

Fixes #5201
2020-02-21 09:43:55 +00:00
Krishna Sai Veera Reddy 219c94d028 Separate out lint to check lossy whole number float literals 2020-02-20 22:33:36 -08:00
Nipunn Koorapati 78a2507736 Move unneeded_field_pattern to restriction group
Fixes https://github.com/rust-lang/rust-clippy/issues/1741
2020-02-20 13:20:18 -08:00
Krishna Sai Veera Reddy 45936a6e26 Uplift excessive_precision to the correctness category 2020-02-17 00:17:26 -08:00
Lily Chung 7e0af69f1c Reclassify chars_next_cmp as a style lint.
This makes it consistent with chars_last_cmp.
2020-02-12 16:50:29 -08:00
flip1995 f5db351a1d Get {RUSTUP,MULTIRUST}_{HOME,TOOLCHAIN} from runtime environment
Keep the fallback to compile-time environment
2020-02-12 09:34:26 +01:00
Lzu Tao bfc4bd4dbe Impl DefaultCallbacks on our side 2020-02-11 22:52:00 +07:00
Krishna Sai Veera Reddy be1bc571c3 Add option-env-unwrap lint 2020-02-08 16:44:35 -08:00
Areredify 338fb7a3e9 add excessive bools lints 2020-02-05 20:54:58 +03:00
ThibsG 53094de08e Merge fixes 2020-02-04 22:53:24 +01:00
ThibsG 6afd7ea147 Use span_lint_and_sugg + move infaillible lint
- moving infaillible lint to prevent collisions
2020-02-04 22:49:08 +01:00
flip1995 5ba4aa8eba Move debug_assertions_with_mut_call to nursery 2020-01-31 10:57:52 +01:00
bors ca2abaf366 Auto merge of #5109 - phansch:ciao_util_dev, r=flip1995
Deprecate util/dev in favor of cargo alias

This means one less shell script and a bit more cross-platform support
for contributors.

If you've been using `./util/dev` before, this now becomes `cargo dev`.

The key part of this change is found in `.cargo/config` where an alias for calling the `clippy_dev` binary is defined.

changelog: none
2020-01-31 07:18:06 +00:00
Philipp Hansch 4d1a11d354 Deprecate util/dev in favor of cargo alias
If you've been using `./util/dev` before, this now becomes `cargo dev`.

The key part of this change is found in `.cargo/config`.

This means one less shell script and a bit more cross-platform support
for contributors.
2020-01-30 21:34:31 +01:00
Mikhail Babenko 9b88a2b295 decouple 'let_underscore' tests 2020-01-30 16:51:23 +03:00
Mikhail Babenko d1f8621711 add lint 2020-01-30 16:48:56 +03:00
xiongmao86 512efbea23 Declare lint and implement lint logic. 2020-01-30 00:21:29 +08:00
Areredify 796958c7e2 add option_as_ref_deref lint 2020-01-23 16:12:16 +03:00
bors dd06c06183 Auto merge of #5028 - krishna-veerareddy:issue-5026-mem-ordering-fences, r=phansch
Detect usage of invalid atomic ordering in memory fences

Detect usage of `core::sync::atomic::{fence, compiler_fence}` with `Ordering::Relaxed` and suggest valid alternatives.

changelog: Extend `invalid_atomic_ordering` to lint memory fences

Fixes #5026
2020-01-21 05:53:46 +00:00
Yuki Okushi 95c369fa91 Add skip_while_next lint 2020-01-20 10:56:02 +09:00
Yuki Okushi ae872fe1c7 Rename ok_if_let to if_let_some_result 2020-01-19 10:06:08 +09:00
Andre Bogus ff5fb19bbd Downgrade range_plus_one to pedantic 2020-01-18 09:40:36 +01:00
xiongmao86 bba468887b Pull master, rebase, and update_lints again. 2020-01-12 19:54:17 +08:00