Commit graph

1396 commits

Author SHA1 Message Date
bors
c25f26d4ca Auto merge of #5411 - dtolnay:hasher, r=flip1995
Downgrade implicit_hasher to pedantic

From the [documentation](https://rust-lang.github.io/rust-clippy/master/index.html#implicit_hasher), this lint is intended to suggest:

```diff
- pub fn foo(map: &mut HashMap<i32, i32>) { }

+ pub fn foo<S: BuildHasher>(map: &mut HashMap<i32, i32, S>) { }
```

I think this is pedantic. I get that this lint can benefit core libraries like serde, but that's exactly the use case for pedantic lints; a library like serde will [enable clippy_pedantic](fd6741f4b0/src/lib.rs (L304)) and take the time to go through everything possible. Similar for libraries doing a libz blitz style checkup before committing to a 1.0 release; it would make sense to run through all the available pedantic lints then.

But otherwise, for most codebases and certainly for industrial codebases, the above suggested change just makes the codebase more obtuse for questionable benefit.

changelog: Remove implicit_hasher from default set of enabled lints
2020-04-08 17:14:09 +00:00
David Tolnay
5f92faec6d
Downgrade implicit_hasher to pedantic 2020-04-08 08:43:20 -07:00
David Tolnay
899a1b5598
Move cognitive_complexity to nursery 2020-04-08 08:37:20 -07:00
Philipp Krones
7cb5180dfb
Rollup merge of #5420 - dtolnay:newret, r=flip1995
Downgrade new_ret_no_self to pedantic

As motivated by #5418. This is the second most widely suppressed Clippy style lint, and [this grep.app search](https://grep.app/search?q=%5C%5Ballow%5C%28.%2Aclippy%3A%3Anew_ret_no_self%5Cb&regexp=true&case=true&filter[lang][0]=Rust) shows a large number of diverse reasonable signatures for a `new` method.

changelog: Remove new_ret_no_self from default set of enabled lints
2020-04-08 15:50:24 +02:00
Philipp Krones
2011d9a783
Rollup merge of #5419 - dtolnay:unreadable, r=flip1995
Downgrade unreadable_literal to pedantic

As motivated by #5418. This is the top most commonly suppressed Clippy style lint, which indicates that the community has decided they don't share Clippy's opinion on the best style of this.

I've left the lint in as pedantic, though it could be that "restriction" would be better -- I can see this lint being useful as an opt-in restriction in some codebases.

changelog: Remove unreadable_literal from default set of enabled lints
2020-04-08 15:50:23 +02:00
Philipp Krones
a1e49f962c
Rollup merge of #5415 - nickrtorres:master, r=flip1995
Add new lint for `Result<T, E>.map_or(None, Some(T))`

Fixes #5414

PR Checklist
---
- [x] Followed lint naming conventions (the name is a bit awkward, but it seems to conform)
- [x] Added passing UI tests (including committed .stderr file)
- [x] cargo test passes locally
- [x] Executed cargo dev update_lints
- [x] Added lint documentation
- [x] Run cargo dev fmt

`Result<T, E>` has an [`ok()`](https://doc.rust-lang.org/std/result/enum.Result.html#method.ok) method that adapts a `Result<T,E>` into an `Option<T>`.
It's possible to get around this adapter by writing `Result<T,E>.map_or(None, Some)`.

This lint is implemented as a new variant of the existing [`option_map_none` lint](https://github.com/rust-lang/rust-clippy/pull/2128)
2020-04-08 15:50:20 +02:00
Philipp Krones
5ea4771433
Rollup merge of #5412 - dtolnay:tostring, r=flip1995
Downgrade inefficient_to_string to pedantic

From the [documentation](https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string):

> ```diff
> - ["foo", "bar"].iter().map(|s| s.to_string());
>
> + ["foo", "bar"].iter().map(|&s| s.to_string());
> ```

I feel like saving 10 nanoseconds from the formatting machinery isn't worth asking the programmer to insert extra `&` / `*` noise in the *vast* majority of cases. This is a pedantic lint.

changelog: Remove inefficient_to_string from default set of enabled lints
2020-04-08 15:50:19 +02:00
Philipp Krones
1e1bd519a1
Rollup merge of #5410 - dtolnay:trivially, r=flip1995
Downgrade trivially_copy_pass_by_ref to pedantic

The rationale for this lint is documented as:

> In many calling conventions instances of structs will be passed through registers if they fit into two or less general purpose registers.

I think the purported performance benefits of clippy's recommendation are overstated. This isn't worth asking people to sprinkle code with more `*`​`*`​`&`​`*`​`&` to chase the alleged performance.

This should be a pedantic lint that is disabled by default and opted in if some specific performance sensitive codebase determines that it is worthwhile.

As a reminder, a typical place that a reference to a primitive would come up is if the function is used as a filter. Triggering a performance-oriented lint on this type of code is the definition of pedantic.

```rust
fn filter(_n: &i32) -> bool {
    true
}

fn main() {
    let v = vec![1, 2, 3];
    v.iter().copied().filter(filter).for_each(drop);
}
```

```console
warning: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte)
 --> src/main.rs:1:15
  |
1 | fn filter(_n: &i32) -> bool {
  |               ^^^^ help: consider passing by value instead: `i32`
```

changelog: Remove trivially_copy_pass_by_ref from default set of enabled lints
2020-04-08 15:50:17 +02:00
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
560c8c9c70
Downgrade new_ret_no_self to pedantic 2020-04-04 12:58:18 -07:00
David Tolnay
be34bc46ed
Downgrade unreadable_literal to pedantic 2020-04-04 12:52:03 -07:00
Nick Torres
91d8a804d3 result_map_or_into_option: add lint to catch manually adpating Result -> Option
Result<T, E> has an `ok()` method that adapts a Result<T,E> into an Option<T>.
It's possible to get around this adapter by writing Result<T,E>.map_or(None, Some).

This lint is implemented as a new variant of the existing
[`option_map_none` lint](https://github.com/rust-lang/rust-clippy/pull/2128)
2020-04-04 03:17:13 -07:00
David Tolnay
e26ae7a0ff
Downgrade inefficient_to_string to pedantic 2020-04-02 20:00:12 -07:00
David Tolnay
94154cad20
Downgrade trivially_copy_pass_by_ref to pedantic 2020-04-02 18:56:10 -07: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
Jane Lusby
680cc2f258 dogfood tasted bad 2020-03-27 14:05:47 -07:00
Jane Lusby
e190cc5590 fix rustfmt issue 2020-03-27 13:26:34 -07:00
Jane Lusby
399e0231cd boycott manish 2020-03-27 13:23:06 -07:00
Jane Lusby
df2d3c82df check for unstable options 2020-03-27 12:48:08 -07:00
Jane Lusby
7c479fd8a7 Start work on clippy-fix as subcommand 2020-03-27 12:48:08 -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
xiongmao86
2909bc372f ./util/dev update_lints. 2020-01-12 19:54:17 +08:00
xiongmao86
96334d0d7c Declare lint. 2020-01-12 19:54:17 +08:00
Krishna Sai Veera Reddy
e2e40f2570 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.
2020-01-09 09:49:15 -08:00
bors
ac795a6f3a Auto merge of #4960 - ThibsG:patterns_with_wildcard_#4640, r=flip1995
New lint: pats_with_wild_match_arm

Wildcard use with other pattern in same match arm.

The wildcard covers other(s) pattern(s) as it will match anyway.

changelog: add new lint when multiple patterns (including wildcard) are used in a match arm.

Fixes #4640.
2020-01-09 13:51:00 +00:00
Yuki Okushi
822de884ff Rustup to rust-lang/rust#68024 2020-01-09 16:43:51 +09:00
Krishna Sai Veera Reddy
b793cf09f2 Move transmute_float_to_int lint to complexity
`transmute_float_to_int` lint was accidentally added to nursery
so moving it to the complexity group.
2020-01-07 15:53:19 -08:00
ThibsG
0fa0df9efb Span help without suggestion 2020-01-07 19:10:59 +01:00
ThibsG
8ae8b08e32 Change lint name to WILDCARD_IN_OR_PATTERNS 2020-01-07 18:48:16 +01:00
ThibsG
d60c6f9398 Move to complexity and adapt test
- test wildcard_enum_match_arm has been impacted by this new lint
2020-01-07 18:48:16 +01:00
ThibsG
96c4198832 New lint: pats_with_wild_match_arm
- Wildcard use with other pattern in same match arm
2020-01-07 18:48:16 +01:00
Yuki Okushi
f7a93f029c Apply suggestion from code review 2020-01-07 18:38:12 +09:00
Yuki Okushi
cd201f526f Update lintlist 2020-01-07 18:38:12 +09:00
Krishna Sai Veera Reddy
fe21ef4e8b Prevent doc-tests from running and fix lint description 2020-01-06 17:33:28 -08:00
Krishna Sai Veera Reddy
9e6a6069a7 Add lint to detect usage of invalid atomic ordering
Detect usage of invalid atomic ordering modes such as
`Ordering::{Release, AcqRel}` in atomic loads and
`Ordering::{Acquire, AcqRel}` in atomic stores.
2020-01-06 16:39:31 -08:00
Brad Sherman
ab5ff0352e Add lint for iter.nth(0)
- Encourage iter.next() rather than iter.nth(0), which is less readable
2020-01-04 11:20:11 -06:00
Krishna Veera Reddy
42e4595d3a Indicate anonymous lifetimes for types 2019-12-31 09:22:35 -08:00
Krishna Veera Reddy
78b4dfc57c Move mem_replace_with_default out of nursery 2019-12-31 09:22:34 -08:00
Krishna Veera Reddy
8db319f957 Use mem::take instead of mem::replace when applicable
`std::mem::take` can be used to replace a value of type `T`
with `T::default()` instead of `std::mem::replace`.
2019-12-31 09:22:34 -08:00
mgr-inz-rafal
f191e916bd Add new lint (modulo_arithmetic) 2019-12-28 16:46:08 +01:00
bors
1837cbce6c Auto merge of #4885 - rust-lang:mut-key-types, r=flip1995
new lint: mutable_key_type

This fixes #732 - well, partly, it doesn't adress `Hash` impls, but the use of mutable types as map keys or set members

changelog: add `mutable_key_type` lint

r? @flip1995
2019-12-24 13:32:45 +00:00
Andre Bogus
40435acf3d new lint: mutable_key_type 2019-12-24 13:46:19 +01:00
Lzu Tao
f5b896451a do minor cleanups
* ToString and AsRef are in prelude, no need to import them
2019-12-24 03:06:52 +07:00
Mikhail Babenko
a310cb2d0b implemented let_underscore lint
actually add files

update lints

change to pedantic
2019-12-22 22:10:25 +03:00
flip1995
710c749bb1
Deprecate unused_label lint
This lint was uplifted/turned into warn-by-default in rustc
2019-12-21 16:20:30 +01:00
Michael Wright
3a81e60a29 Update lints for iterator_step_by_zero changes 2019-12-20 08:22:43 +02:00
Michael Wright
ecbfa386d4 Fix iterator_step_by_zero definition 2019-12-18 19:19:53 +02:00
Krishna Veera Reddy
728a2418cb Fix clippy build failure
Clippy build fails because the feature `result_map_or` has been
stabilized in v1.41.0 but we still have an explicit feature
attribute for it.
2019-12-16 22:29:05 -08:00
Krishna Veera Reddy
c77fc06d52 Add lint to detect transmutes from float to integer
Add lint that detects transmutation from a float to an integer
and suggests usage of `{f32, f64}.to_bits()` instead.
2019-12-07 16:33:49 -08:00
RobbieClarken
f5d0a452ba Add lint for pub fns returning a Result without documenting errors
The Rust Book recommends that functions that return a `Result` type have
a doc comment with an `# Errors` section describing the kind of errors
that can be returned
(https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#commonly-used-sections).
This change adds a lint to enforce this. The lint is allow by default;
it can be enabled with `#![warn(clippy::missing_errors_doc)]`.

Closes #4854.
2019-12-06 17:19:05 +10:30
Philipp Hansch
44eec0884d
Feed the dog 2019-11-29 20:47:50 +01:00
Philipp Hansch
36c6a18217
Update custom ICE function with latest rustc 2019-11-29 20:47:50 +01:00
Philipp Hansch
fc57c84abe
Use Clippy version in ICE message 2019-11-29 20:47:50 +01:00
Philipp Hansch
676f14baa0
Add custom ICE message that points to Clippy repo
This utilizes https://github.com/rust-lang/rust/pull/60584 by setting
our own `panic_hook` and pointing to our own issue tracker instead of
the rustc issue tracker.

This also adds a new internal lint to test the ICE message.

**Potential downsides**

* This essentially copies rustc's `report_ice` function as
  `report_clippy_ice`. I think that's how it's meant to be implemented, but
  maybe @jonas-schievink could have a look as well =)

  The downside of more-or-less copying this function is that we have to
  maintain it as well now.
  The original function can be found [here][original].
* `driver` now depends directly on `rustc` and `rustc_errors`

Closes #2734

[original]: 59367b074f/src/librustc_driver/lib.rs (L1185)
2019-11-29 20:47:47 +01:00
bors
04036877ef Auto merge of #4863 - phansch:use_self, r=flip1995
Move use_self to nursery

Closes #4859

We have a lot of false positives in this lint, so I think it makes sense
to move this to the nursery until they are resolved.

changelog: Move `use_self` lint to nursery, due to many false positives
2019-11-29 18:17:41 +00:00
Philipp Hansch
70a2a29453
Move use_self to nursery
Closes #4859

We have a lot of false positives in this lint, so I think it makes sense
to move this to the nursery until they are resolved.

changelog: Move `use_self` lint to nursery, due to many false positives
2019-11-29 07:51:49 +01:00
flip1995
a61fd43a79
Don't error on clippy.toml of dependencies 2019-11-28 16:42:29 +01:00
bors
d377486561 Auto merge of #4821 - Areredify:as_conversions, r=flip1995
Add `as_conversions` lint

changelog: closes #4771, adding a new pedantic allow-by-default lint that lints against any usage of `as`.
2019-11-28 08:53:36 +00:00
Lzu Tao
d0e0ffa99f make use of Result::map_or 2019-11-28 10:52:20 +07:00
Mikhail Babenko
9ec8888b91 implemented as_conversions lint
actuall add files

add better example and change pedantic to restriction
2019-11-25 18:12:52 +03:00
flip1995
9b4faf97f3
Run update_lints 2019-11-23 17:57:28 +01:00
flip1995
7db973d06f
Merge remote-tracking branch 'FlorianRohm/issue/4623' into rollup-new-lints 2019-11-23 17:56:13 +01:00
flip1995
353668ee6c
Merge remote-tracking branch 'Areredify/large_stack_arrays' into rollup-new-lints 2019-11-23 17:55:10 +01:00
flip1995
213765a1d3
Merge remote-tracking branch 'popzxc/if-same-cond-fn' into rollup-new-lints 2019-11-23 17:54:26 +01:00
flip1995
d151ef7437
Merge remote-tracking branch 'upstream/zst-offset' into rollup-new-lints 2019-11-23 17:53:41 +01:00
flip1995
7bae5bd828
Add comment for mir_opt_level=0 2019-11-23 01:26:19 +01:00
flip1995
e3a74ed2b5
Set mir_opt_level=0
This introduces some FNs. But a building Clippy is more important for now
2019-11-22 14:25:44 +01:00
Igor Aleksanov
bbb8cd4fbb Implement if_same_cond_fn lint
Run ./util/dev

Revert changelog entry

Rename lint to same_functions_in_if_condition and add a doc example

Add testcases with different arg in fn invocation
2019-11-20 06:54:46 +03:00
Andre Bogus
c21b198576 New lint: zst_offset 2019-11-15 22:39:27 +01:00
Florian Rohm
73806b72a9 register new lint "tabs in doc comments" and update readme 2019-11-15 16:26:30 +01:00
Areredify
7fddac0404 Add new lint: large stack array
added documentation

minor style fix

change as to ::from

add ignore to doc

include threshold in lint message/make suggestion more apparent/use Scalar api instead of matching

style fix

shange snippet_opt to snippet
2019-11-13 21:44:29 +03:00
Mikhail Babenko
227dc44aee display help on empty command line arguments 2019-11-13 04:27:43 +03:00
Michael Wright
5817a4fa06 Add to_digit_is_some lint 2019-11-10 15:52:59 +02:00
Heinz N. Gies
2f1370d64c Update lints 2019-11-07 17:13:26 +01:00
Heinz N. Gies
eae6a62db7 Simplify dentry point detection 2019-11-07 17:11:05 +01:00
Heinz N. Gies
60c2fdd0b9 Update lints 2019-11-07 17:10:18 +01:00
flip1995
08fd397c2c
Deprecate into_iter_on_array lint
This lint was uplifted/reimplemented by rustc.
Rustup to rust-lang/rust#66017
2019-11-07 14:04:29 +01:00
bors
eae7b997dd Auto merge of #4714 - msizanoen1:remove-plugin, r=Manishearth
Remove clippy plugin

This PR removes the clippy plugin, which is already deprecated and is causing the `fmt_macros` not found error in rust-lang/rust#62558: https://github.com/rust-lang/rust/issues/62558#issuecomment-529884322

changelog: remove plugin interface
2019-11-06 03:21:01 +00:00
flip1995
1e1d45a005
Move manual_mul_add into nursery 2019-10-26 19:57:01 +02:00
msizanoen
a127e14631 Remove clippy plugin 2019-10-24 21:12:19 +07:00
Mark Rousskov
7e77f3c29f
Update clippy for latest rustc changes
Specifically, this revises the clippy integration to utilize a new
callback to register its lints, as the prior editing of lint store in
Session is no longer possible.
2019-10-24 11:40:45 +02:00
Marcel Hellwig
5572476a36 Add lint for debug_assert_with_mut_call
This lint will complain when you put a mutable function/method call
inside a `debug_assert` macro, because it will not be executed in
release mode, therefore it will change the execution flow, which is not
wanted.
2019-10-22 10:39:55 +02:00
Heinz N. Gies
7f454d8d06 Split out tests 2019-10-18 07:40:48 +02:00
Heinz N. Gies
98dc3aabea Add todo and tests 2019-10-18 07:37:58 +02:00
HMPerson1
76b44f34b9
Add inefficient_to_string lint 2019-10-16 15:54:20 -04:00
James Wang
e23a424b31
Change lint to be pedantic 2019-10-15 09:58:11 +02:00
James Wang
664522badd
Add a new lint for unused self 2019-10-15 09:58:11 +02:00
Andre Bogus
cc622608db new lints around #[must_use] fns
`must_use_unit` lints unit-returning functions with a `#[must_use]`
attribute, suggesting to remove it.

`double_must_use` lints functions with a plain `#[must_use]`
attribute, but which return a type which is already `#[must_use]`,
so the attribute has no benefit.

`must_use_candidate` is a pedantic lint that lints functions and
methods that return some non-unit type that is not already
`#[must_use]` and suggests to add the annotation.
2019-10-14 12:09:04 +02:00
Nikos Filippakis
5143fe1a78 New lint: suspicious_unary_op_formatting
Lints when, on the RHS of a BinOp, there is a UnOp without a space
before the operator but with a space after (e.g. foo >- 1).

Signed-off-by: Nikos Filippakis <nikolaos.filippakis@cern.ch>
2019-10-09 16:22:00 +02:00
Ethan Lam
327c91f8c7 Addresses Issue #4001
Fixed typo

Fixes lint name and uses appropriate linting suggestion

changed lint help message

Added autofixable test

Added Autofixable Test

Removed Broken Autofixable File

updated lints

Generated Autofixable/Nonfixable Test Cases

Changed Suggestion Applicability

Updated Lint Count
2019-10-08 08:46:29 -05:00
bors
e2393b09ac Auto merge of #4592 - rust-lang:transmute-collection, r=flip1995
New lint: `unsound_collection_transmute`

changelog: Add `unsound_collection_transmute` lint

This fixes #4515
2019-10-08 05:51:07 +00:00
Shotaro Yamada
301ef6bb2a Fix false-positive of redundant_clone and move to clippy::perf 2019-10-03 08:10:29 +09:00
Andre Bogus
27fa2b7944 New lint: unsound_collection_transmute 2019-10-02 21:18:00 +02:00
Andre Bogus
23a9c02120 New lint: needless_doc_main 2019-10-02 17:17:22 +02:00
James Wang
52408f5b7d
Add a new lint for comparison chains 2019-09-24 16:55:05 -05:00
Michael Wright
d04bf15114 Merge branch 'master' into unneeded_wildcard_pattern 2019-09-22 08:59:23 +02:00
Andre Bogus
8d884c8a1a new lint: mem-replace-with-uninit 2019-09-20 00:25:57 +02:00
bors
f08f171530 Auto merge of #4539 - jolson88:cast-lossless-pedantic, r=flip1995
Changes cast-lossless to a pedantic lint

As discussed in #4528, this moves the cast-lossless lint from `all` to `pedantic`.

I couldn't tell from description alone if it should also be removed from the complexity category, so I left it as part of complexity for now. I didn't see any impact to the tests from this change, but I could be wrong (as this is my first PR).

fixes #4528

changelog: Moves cast-lossless from default to checking only as a `pedantic` lint.
2019-09-19 08:50:31 +00:00
Andre Bogus
70a7dab773 New lint: Require # Safety section in pub unsafe fn docs 2019-09-19 09:19:55 +02:00
Jason Olson
cc68d8135b
Changes to catch_fatal_errors in rustc driver
A [recent PR](https://github.com/rust-lang/rust/pull/60584/files#diff-707a0eda6b2f1a0537abc3d23133748cL1151)
changed the function name from `report_ices_to_stderr_if_any` to `catch_fatal_errors`. This PR changes to using
the new function name.
2019-09-16 11:08:45 -07:00
Jason Olson
6f1f413717
Changes cast-lossless to a pedantic lint
Fixes #4528
2019-09-15 10:32:45 -07:00
Michael Wright
4a3bc6b592 Add unneeded-wildcard-pattern lint 2019-09-12 08:25:05 +02:00
Yuki Okushi
e236740f28 Fix redundant_pattern false positive 2019-09-05 00:36:48 +09:00
bors
9d2772207e Auto merge of #4418 - euclio:byte-lit-suggestion, r=flip1995
use a structured suggestion for char-lit-as-u8

changelog: use a structured suggestion for char-lit-as-u8
2019-09-04 13:33:47 +00:00
flip1995
14d1d040b4
Run update_lints 2019-09-04 15:33:14 +02:00
Shotaro Yamada
4960f79476 Add manual_saturating_arithmetic lint 2019-09-04 18:38:25 +09:00
Andre Bogus
b01f2d1126 lint against MaybeUninit::uninit().assume_init() 2019-09-03 17:37:38 +02:00
Lzu Tao
ab335eacb4 Run update_lints for Unicode lint 2019-08-23 09:49:49 +00:00
Simon Sapin
08d8ffc6a9 Import rustc_plugin from its new location
Depends on https://github.com/rust-lang/rust/pull/62727
2019-08-19 17:52:10 +02:00
Lzu Tao
7065239da5 Add option_and_then_some lint 2019-08-19 03:54:40 +00:00
bors
f01a0c0e08 Auto merge of #4403 - xd009642:type_repetition_improvements, r=phansch,flip1995
Improvements to `type_repetition_in_bounds`

Improvements to the `type_repetition_in_bounds` trait based on feedback from #4380 #4326 #4323

Currently just make it pedantic. Hopefully, more to come

changelog: move `type_repetition_in_bounds` to `pedantic`
2019-08-18 21:03:21 +00:00
xd009642
76598adafb Run update_lints 2019-08-18 16:59:31 +01:00
Jeremy Stucki
9c39c02b75
Change lint type to 'complexity' 2019-08-18 16:49:11 +02:00
Jeremy Stucki
5df84f2192
Merge branch 'origin/master' into suspicious_map 2019-08-18 16:37:31 +02:00
KRAAI, MATTHEW [VISUS]
a68abc03a2 Remove "a" from single_match_else description 2019-08-16 05:41:35 -07:00
Jeremy Stucki
f4f31a4ff4
Implement lint 'suspicious_map' 2019-08-15 22:58:32 +02:00
Philipp Hansch
42f03539ca
Deprecate unused_collect lint
I found this because we only had two test cases in total for this lint.
It turns out the functionality is fully covered by rustc these days.

[Playground Examples](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=eb8ee6db389c77180c9fb152d3c608f4)

changelog: Deprecate `unused_collect` lint. This is fully covered by
rustc's `#[must_use]` on `collect`

cc #2846
2019-08-14 21:47:11 +02:00
Jeremy Stucki
4275d7b6ac
Run 'update_lints' 2019-08-12 21:47:12 +02:00
Jeremy Stucki
b651f19eb8
Rename 'flat_map' → 'flat_map_identity' 2019-08-11 20:34:25 +02:00
Jeremy Stucki
f0ce04f814
Handle calls with 'std::convert::identity' 2019-08-11 19:51:43 +02:00
Jeremy Stucki
05d9f884e1
Merge branch 'origin/master' into flat-map 2019-08-11 19:22:40 +02:00
Ralf Jung
40fea7a9e0 update_lints 2019-08-11 11:02:25 +02:00
flip1995
a922f800af
Run update_lints and fmt 2019-08-05 13:24:31 +02:00
Vincent Dal Maso
77b21b644f
Move expression check to LateLintPass
Changes:
- Move from EarlyLintPass
- Fix entrypoint check with function path def_id.
2019-08-05 13:23:30 +02:00
flip1995
e6a836e2e8
Move UNNECESSARY_UNWRAP to complexity and PANICKING_UNWRAP to correctness 2019-08-01 15:14:06 +02:00
xd009642
925e8207fa Respond to review comments
Update README and CHANGELOG using the util scripts, refine the help message and fix the float_cmp error.
2019-07-27 21:58:29 +01:00
Matthias Krüger
a865fe607c rustup https://github.com/rust-lang/rust/pull/62679/ 2019-07-19 16:41:10 +02:00
Darth-Revan
b7145fbb66
Fix "unkown clippy lint" error in UI test. 2019-07-17 08:58:36 +02:00
Darth-Revan
0513202d25
Implement lint for inherent to_string() method. 2019-07-17 08:58:32 +02:00
bors
a73bb33399 Auto merge of #4273 - mikerite:deny-warnings, r=flip1995
Deny warnings in CI

changelog: none
2019-07-15 07:51:29 +00:00
Michael Wright
b523d35d41 Deny warnings in CI 2019-07-15 07:35:02 +02:00
flip1995
c100c70822
Build sys_root in driver with PathBuf instead of String 2019-07-13 12:48:42 +02:00
Jeremy Stucki
c7da4c26fb
Implement flat_map lint 2019-07-08 17:11:54 +02:00
Joe Frikker
1e6c6976dd PR comments 2019-06-23 18:02:13 -04:00
Joe Frikker
60a80849ce Adding try_err lint 2019-06-22 16:37:05 -04:00
David Tolnay
f88a387c3f
Downgrade integer_division to restriction 2019-06-15 00:17:04 -07:00
flip1995
0e480ca4bc
Use replace_region_in_file for creating the lint list 2019-06-14 13:07:33 +02:00
Jane Lusby
2719c1e6a3 minor fix 2019-06-12 12:29:37 -07:00
Jane Lusby
a2bf96f1c6 make it pass dogfood 2019-06-12 12:29:37 -07:00
Jane Lusby
113ae891d9 run rustfmt 2019-06-12 12:29:37 -07:00
Jane Lusby
73259d68db fix padding and put clippy someplaces 2019-06-12 12:29:37 -07:00
Jane Lusby
cfd7e0d5fd show default lint levels 2019-06-12 12:29:37 -07:00
Jane Lusby
07ccec86a5 group printing 2019-06-12 12:29:37 -07:00
Jane Lusby
296794dec5 prelim arg parse 2019-06-12 12:29:37 -07:00
Jane Lusby
5abcff2be5 move Lint static def into its own module 2019-06-12 12:29:37 -07:00
Jane Lusby
f6367c41dc switch to sorted usable lints 2019-06-12 12:29:37 -07:00
Jane Lusby
cf88c8487a initial commit for help improvements on clippy-driver 2019-06-12 12:29:37 -07:00
Matthias Krüger
6967cf59a4 clippy-driver: use rustc_tools_util to get version info.
This will add git hash information to `clippy-driver -V` output.
2019-05-01 10:43:16 +02:00
Matthias Krüger
414c34c300
rustup 41316f0449025394fdca6606d3fdb3b8f37a9872 2019-04-01 20:37:05 +02:00
Félix Fischer
491f72442e
Updated source to match with recent rustc master toolchain changes 2019-04-01 20:37:05 +02:00
Philipp Hansch
c730de955e
Remove some unused features and error-patterns 2019-03-12 08:15:50 +01:00
Alexander Regueiro
d43966a176 Various cosmetic improvements. 2019-03-10 18:06:28 +00:00
John Kåre Alsaker
1388f2488e rustfmt 2019-03-10 12:00:17 +01:00