flip1995
30503a91d2
Move matches test in matches module
2020-04-03 22:02:27 +02:00
flip1995
045722a17e
Run update_lints
2020-04-03 21:19:33 +02: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
flip1995
98aa5938c4
Rustup to rust-lang/rust#70634
2020-04-02 22:29:41 +02:00
Simon Farnsworth
5f8b696e2e
Update clippy_lints/src/types.rs
...
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2020-04-02 14:30:13 +01:00
Simon Farnsworth
50ecc12541
Update types.rs
2020-04-02 14:29:08 +01:00
Simon Farnsworth
f3f1babc1b
Update types.rs
2020-04-02 14:28:25 +01:00
Simon Farnsworth
db3423f46a
Improve docs for option_option
...
Hint about using tri-state enums to replace legitimate uses of `Option<Option<_>>`
2020-04-02 10:03:15 +01:00
bors
a840d594cc
Auto merge of #5349 - jpospychala:useless_rc, r=Manishearth
...
useless Rc<Rc<T>>, Rc<Box<T>>, Rc<&T>, Box<&T>
refers to #2394
changelog: Add lints for Rc<Rc<T>> and Rc<Box<T>> and Rc<&T>, Box<&T>
this is based on top of another change #5310 so probably should go after that one.
2020-04-02 03:11:29 +00:00
Jacek Pospychala
f8e892db5e
useless Rc<Rc<T>>, Rc<Box<T>>, Rc<&T>, Box<&T>
2020-04-02 00:02:25 +02:00
bors
7ebb3aa55d
Auto merge of #5402 - pmk21:allow-let-underscore-must-use, r=flip1995
...
Allow let_underscore_must_use to be ignored
changelog: none
Fixes #5366
2020-04-01 21:43:44 +00:00
bors
42796e11c5
Auto merge of #5401 - dtolnay:option, r=Manishearth
...
Downgrade option_option to pedantic
Based on a search of my work codebase (\>500k lines) for `Option<Option<`, it looks like a bunch of reasonable uses to me. The documented motivation for this lint is:
> an optional optional value is logically the same thing as an optional value but has an unneeded extra level of wrapping
which seems a bit bogus in practice. For example a typical usage would look like:
```rust
let mut host: Option<String> = None;
let mut port: Option<i32> = None;
let mut payload: Option<Option<String>> = None;
for each field {
match field.name {
"host" => host = Some(...),
"port" => port = Some(...),
"payload" => payload = Some(...), // can be null or string
_ => return error,
}
}
let host = host.ok_or(...)?;
let port = port.ok_or(...)?;
let payload = payload.ok_or(...)?;
do_thing(host, port, payload)
```
This lint seems to fit right in with the pedantic group; I don't think linting on occurrences of `Option<Option<T>>` by default is justified.
---
changelog: Remove option_option from default set of enabled lints
2020-04-01 21:30:24 +00:00
pmk21
c9978b69bd
Allow let_underscore
2020-04-02 00:48:16 +05:30
David Tolnay
86b0dd4197
Downgrade option_option to pedantic
2020-04-01 12:00:49 -07:00
flip1995
fcc56fcd1b
Fix dogfood fallout
2020-04-01 20:24:46 +02:00
flip1995
7d58ba20b4
Rustup to rust-lang/rust#70632
2020-04-01 20:14:05 +02:00
flip1995
3142ee3f7a
Rustup to rust-lang/rust#70627
2020-04-01 19:42:15 +02:00
pmk21
4cac9786c5
Skip single_match lints in macro rules
2020-03-31 15:50:15 +05:30
bors
1cac2f9e86
Auto merge of #5293 - matthiaskrgr:macro_skip_lifetime, r=phansch
...
don't emit lifetime lint warnings for code inside macros.
Fixes #5283
changelog: Don't emit lifetime lint warnings for code inside macros.
2020-03-30 21:33:49 +00:00
Matthias Krüger
8e83afa61f
don't emit lifetime lints for code inside macros.
...
Fixes #5283
2020-03-30 23:22:50 +02:00
bors
0a25944f78
Auto merge of #5294 - tmiasko:trait-ptr-cmp, r=Manishearth
...
Lint unnamed address comparisons
Functions and vtables have an insignificant address. Attempts to compare such addresses will lead to very surprising behaviour. For example: addresses of different functions could compare equal; two trait object pointers representing the same object and the same type could be unequal.
Lint against unnamed address comparisons to avoid issues like those in rust-lang/rust#69757 and rust-lang/rust#54685.
changelog: New lints: [`fn_address_comparisons`] [#5294 ](https://github.com/rust-lang/rust-clippy/pull/5294 ), [`vtable_address_comparisons`] [#5294 ](https://github.com/rust-lang/rust-clippy/pull/5294 )
2020-03-30 19:52:41 +00:00
Tomasz Miąsko
b77b219280
Lint unnamed address comparisons
2020-03-30 21:42:16 +02:00
bors
42c36dc77b
Auto merge of #5365 - mgr-inz-rafal:issue4983_bool_updates, r=yaahc
...
Issue4983 bool updates
changelog: Check for bool inequality comparison that might be written more concisely
Fixes #4983
2020-03-30 19:20:10 +00:00
Jane Lusby
c8f3241177
Update clippy_lints/src/needless_bool.rs
2020-03-30 12:19:30 -07:00
bors
563da5248d
Auto merge of #5387 - jpospychala:useless_self_fp, r=yaahc
...
`unused_self` false positive
fixes #5351
Remove the for loop in `unused_self` so that lint enabled for one method doesn't trigger on another method.
changelog: Fix false positive in `unused_self` around lint gates on impl items
2020-03-30 18:10:21 +00:00
Matthias Krüger
aff57e0f43
rustup https://github.com/rust-lang/rust/pull/70536
2020-03-30 11:17:58 +02:00
bors
bfd11235a6
Auto merge of #5380 - lzutao:deprecate-REPLACE_CONSTS, r=phansch
...
Deprecate REPLACE_CONSTS lint
Closes #5346
changelog: Deprecate `replace_consts` lint
2020-03-30 08:03:42 +00:00
Philipp Hansch
68ed6ccf04
Rustup to https://github.com/rust-lang/rust/pull/70449
2020-03-30 07:34:19 +02:00
Jacek Pospychala
82f929cbaf
unused_self
false positive
2020-03-29 22:22:36 +02:00
Lzu Tao
d055b7d61c
Deprecate REPLACE_CONSTS lint
2020-03-29 12:59:35 +07:00
bors
70b93aab6e
Auto merge of #5376 - flip1995:verbose_file_reads_restriction, r=matthiaskrgr
...
Move verbose_file_reads to restriction
cc #5368
Using `File::read` instead of `fs::read_to_end` does make sense in multiple cases, so this lint is rather restriction, than complexity
changelog: Move [`verbose_file_reads`] to restriction
2020-03-27 20:13:06 +00:00
Matthias Krüger
0982097e4d
remove redundant import
2020-03-27 20:47:34 +01:00
Matthias Krüger
48da6e926c
rustup https://github.com/rust-lang/rust/pull/68404
2020-03-27 20:41:53 +01:00
Matthias Krüger
6b1bad54ef
rustup https://github.com/rust-lang/rust/pull/69644
2020-03-27 20:41:51 +01:00
Matthias Krüger
8177e49e10
rustup https://github.com/rust-lang/rust/pull/70344
2020-03-27 20:41:35 +01: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
Philipp Hansch
cec1e8f74e
Remove dependency on matches
crate
...
The std equivalent works exactly the same.
2020-03-25 07:50:08 +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
bors
d3989eef2d
Auto merge of #5319 - 1tgr:master, r=flip1995
...
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them
changelog: Add `redundant_pub_crate` lint
Closes #5274 .
2020-03-23 20:35:49 +00:00
mgr-inz-rafal
ff9602515e
Code clean-up and formatting
2020-03-23 21:21:18 +01:00
mgr-inz-rafal
3d3af07845
Provide appropriate suggestion
2020-03-23 21:00:02 +01:00
flip1995
13fcee51e7
Move useless_transmute to nursery
2020-03-23 20:32:04 +01:00
mgr-inz-rafal
12796cd688
Initial lint without suggestion
2020-03-23 20:29:12 +01:00
Tim Robinson
870b9e8139
nursery group -> style
2020-03-23 16:45:31 +00:00
bors
1ff81c1b6d
Auto merge of #5350 - ThibsG:FixSingleBindingClosure, r=flip1995
...
Fix single binding closure
Fix the `match_single_binding` lint when triggered inside a closure.
Fixes : #5347
changelog: Improve suggestion for [`match_single_binding`]
2020-03-23 15:17:09 +00:00
Matthias Krüger
0f319513d2
rustup https://github.com/rust-lang/rust/pull/69968/
2020-03-23 15:21:46 +01:00
ThibsG
badfbbbbde
Fix single binding in closure
2020-03-22 10:31:30 +01:00
Tim Robinson
de9092438d
Update for PR feedback
2020-03-20 22:52:53 +00:00
bors
0e5e2c4365
Auto merge of #5323 - rabisg0:fix/5284, r=flip1995
...
Improvement: Don't show function body in needless_lifetimes
Changes the span on which the lint is reported to point to only the
function return type instead of the entire function body.
Fixes #5284
changelog: none
2020-03-20 12:45:30 +00:00
Philipp Krones
606e3285b2
Rollup merge of #5341 - flip1995:rustup, r=flip1995
...
Rustup to rust-lang/rust#66131
changelog: none
2020-03-19 15:00:32 +01:00
Philipp Krones
a46675f229
Rollup merge of #5336 - matthiaskrgr:rustup_35, r=flip1995
...
rustup https://github.com/rust-lang/rust/pull/69920/
changelog: none
2020-03-19 15:00:31 +01:00
Philipp Krones
027706630b
Rollup merge of #5326 - matthiaskrgr:rustup_33, r=flip1995
...
rustup https://github.com/rust-lang/rust/pull/69838
changelog: none
2020-03-19 15:00:29 +01:00
flip1995
21aeb21b8a
Rustup to rust-lang/rust#66131
2020-03-19 14:33:10 +01:00
Matthias Krüger
b9d6bf3bfb
rustup https://github.com/rust-lang/rust/pull/69920/
2020-03-19 09:14:53 +01:00
Rabi Guha
0812a0af4c
Improvement: Don't show function body in needless_lifetimes
...
Changes the span on which the lint is reported to point to only the
function return type instead of the entire function body.
Fixes #5284
2020-03-19 12:03:02 +05:30
bors
e004b9431d
Auto merge of #5329 - matthiaskrgr:int_arith_on_ref_5328, r=flip1995
...
integer_arithmetic: detect integer arithmetic on references.
changelog: integer_arithmetic fix false negatives with references on integers
Fixes #5328
2020-03-18 14:56:05 +00:00
Matthias Krüger
c7c7ab23aa
integer_arithmetic: detect integer arithmetic on references.
...
Also fixes the same for float_arithmetic.
changelog: integer_arithmetic,float_arithmetic: fix false negatives with references on integers
Fixes #5328
2020-03-18 14:52:01 +01:00
Matthias Krüger
2204bf20ae
clean up a few lint docs
2020-03-18 02:50:39 +01:00
Matthias Krüger
b8effecee1
rustup https://github.com/rust-lang/rust/pull/69838
2020-03-17 10:18:22 +01:00
Matthias Krüger
a97f60b8e3
rustup https://github.com/rust-lang/rust/pull/69738
2020-03-16 18:38:30 +01:00
bors
24f6d643fe
Auto merge of #5322 - phansch:or_patterns, r=matthiaskrgr
...
Make use of `or_patterns` feature
changelog: none
2020-03-16 12:41:04 +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
Matthias Krüger
ba0884bee3
rustup https://github.com/rust-lang/rust/pull/68944
2020-03-16 11:36:17 +01:00
Philipp Hansch
548c417ec4
Make use of or_patterns
feature
2020-03-16 07:25:09 +01:00
Matthias Krüger
4d8ed5a842
rustup https://github.com/rust-lang/rust/pull/69589/
2020-03-15 18:23:43 +01:00
Yuki Okushi
00861d100d
Rustup to rust-lang/rust#69076
2020-03-15 05:26:32 +09:00
Josh Triplett
f56b0a1b34
Document that wildcard_imports doesn't warn about use ...::prelude::*;
2020-03-13 17:07:11 +00:00
bors
8485d40a32
Auto merge of #5304 - sinkuu:redundant_clone_not_consumed, r=flip1995
...
Extend `redundant_clone` to the case that cloned value is not consumed
Fixes #5303 .
---
changelog: Extend `redundant_clone` to the case that cloned value is not consumed
2020-03-12 20:22:31 +00:00
Yuki Okushi
3e3776666e
Rustup to rust-lang/rust#69674
2020-03-13 04:56:55 +09:00
Shotaro Yamada
d9ad33852c
Use visit_place
2020-03-13 02:06:47 +09:00
Shotaro Yamada
aca64b8df7
Check for mutation
2020-03-13 01:25:18 +09:00
Shotaro Yamada
a377378528
Only fires on temporaries
...
`let y = x.clone()` cannot be turned into `let y = x` without moving x,
regardless of whether `y` is consumed or not.
2020-03-13 00:54:40 +09:00
Shotaro Yamada
9de642190e
Extend redundant_clone
to the case that cloned value is not consumed
2020-03-13 00:31:09 +09:00
bors
fdce47ba7d
Auto merge of #5272 - jmeyers35:file_read_lint, r=flip1995
...
add lint on File::read_to_string and File::read_to_end
Adds lint `verbose_file_reads` which checks for use of File::read_to_end and File::read_to_string.
Closes https://github.com/rust-lang/rust-clippy/issues/4916
changelog: add lint on File::{read_to_end, read_to_string}
2020-03-10 22:35:15 +00:00
Jacob Meyers
a4ba1027fc
add CR feedback
2020-03-10 18:00:37 -04:00
bors
23bd427f92
Auto merge of #5298 - rust-lang:needless_doc_main_code, r=flip1995,Manishearth
...
needless_doc_main: only check rust code
This fixes #5280 by checking the language attribute on code blocks.
---
changelog: none
2020-03-10 21:30:44 +00:00
Andre Bogus
2fa3da4869
needless_doc_main: only check rust code
2020-03-10 20:19:37 +01:00
bors
557f6848bd
Auto merge of #5296 - sinkuu:fix_ice_trivial_bounds, r=flip1995
...
Fix ICE with trivial_bounds feature
https://github.com/rust-lang/rust/issues/69874#issuecomment-596890446
changelog: Fix ICE with trivial_bounds feature
2020-03-10 12:25:07 +00:00
Yuki Okushi
8d2a3e0a61
Use node_type_opt
over node_type
2020-03-10 18:18:34 +09:00
Shotaro Yamada
227ef60a2b
Fix doc
2020-03-10 13:28:45 +09:00
Shotaro Yamada
a3d9355bef
Fix ICE with trivial_bounds feature
2020-03-10 13:17:35 +09:00
Matthias Krüger
5fd74a9a6a
clippy_lints: readme: don't mention crates.io since it is no longer used to publish clippy.
2020-03-10 01:05:54 +01:00
Jacek Pospychala
697e3c89a7
Improve placeholder in map_unit_fn
2020-03-09 20:37:06 +01:00
bors
d8f64b6eba
Auto merge of #5287 - matthiaskrgr:pat_isref, r=flip1995
...
redundant_pattern: take binding (ref, ref mut) into account in suggestion
fixes #5271
changelog: redundant_pattern: take binding (ref, ref mut) into account in suggestion (#5271 )
2020-03-09 17:25:09 +00:00
bors
92e25bb7e1
Auto merge of #5286 - matthiaskrgr:delay_vec_creation, r=flip1995
...
check_pat: delay creation of the "normal" vec until we reach the branch where it is actually needed
changelog: none
2020-03-09 17:09:38 +00:00
bors
118594ffa2
Auto merge of #5291 - ThibsG:FixSingleBinding, r=flip1995
...
Fix match single binding when in a let stmt
Fix bad suggestion when `match_single_binding` lints when inside a local (let) statement.
Fixes #5267
changelog: none
2020-03-09 16:04:26 +00:00
ThibsG
40a04f2657
Fix match single binding when in a let stmt
2020-03-09 16:59:24 +01:00
bors
a5477c500c
Auto merge of #5285 - matthiaskrgr:dep_it, r=flip1995
...
deps: bump itertools 0.8 -> 0.9
changelog: none
2020-03-09 14:29:40 +00:00
Vivek Ghaisas
ab6e709ee6
Improve error messages for {option,result}_map_unit_fn
...
Instead of saying "unit function", use the phrase the description
uses: "function that returns the unit type".
Fixes #5180 .
2020-03-08 21:28:06 +00:00
Matthias Krüger
75a2300e27
redundant_pattern: take binding (ref, ref mut) into account in suggestion.
...
fixes #5271
2020-03-08 10:47:18 +01:00
Matthias Krüger
a412b3423e
check_pat: delay creation of the "normal" vec until we reach the branch where is is actually needed
2020-03-08 02:50:33 +01:00
Matthias Krüger
806699342e
deps: bump itertools 0.8 -> 0.9
...
changelog: none
2020-03-08 01:33:17 +01: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
bors
23d2b21297
Auto merge of #5230 - DevinR528:macro-use, r=flip1995
...
Macro use
---
changelog: This lint enforces Rust 2018 idiom of importing macro's directly without `#[macro_use]` fixes #5179 .
2020-03-05 17:30:52 +00:00
bors
329923edec
Auto merge of #5257 - mlegner:cast_hex_fp, r=flip1995
...
Resolve false positives of unnecessary_cast for non-decimal integers
This PR resolves false positives of `unnecessary_cast` for hexadecimal integers to floats and adds a corresponding test case.
Fixes : #5220
changelog: none
2020-03-04 16:11:40 +00:00
Devin R
597e02dcdf
warn on macro_use attr
2020-03-04 09:36:02 -05:00
bors
8c7b3ad3fa
Auto merge of #5266 - sinkuu:questionmark, r=flip1995
...
Lint `if let Some` and early return in question_mark lint
Fixes #5260
changelog: lint `if let Some` and early return in `question_mark` lint
2020-03-04 13:30:08 +00:00
Shotaro Yamada
a78a1fc97b
Apply suggestions from code review
...
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2020-03-04 22:08:50 +09:00
mlegner
185fa0d1b1
Simplify if_chain.
2020-03-04 13:22:54 +01:00
mlegner
d14fdc0203
Move NumericLiteral to its own module.
2020-03-04 13:22:53 +01:00
mlegner
73deb723dd
Included binary and octal cases.
2020-03-04 13:21:01 +01:00
mlegner
6673cc8329
Resolve false positives for hex int cast.
2020-03-04 13:21:00 +01:00
bors
36b65986af
Auto merge of #5258 - ThibsG:UselessBindingInStruct638, r=flip1995
...
Add lint for .. use in fully binded struct
This PR adds the lint `match-wild-in-fully-binded-struct` to prevent the use of the `..` pattern when all fields of the struct are already binded.
Fixes : #638
changelog: Add [`rest_pat_in_fully_bound_structs`] lint to warn against the use of `..` in fully binded struct
2020-03-04 11:06:31 +00:00
bors
8dc3fde127
Auto merge of #5246 - JarredAllen:master, r=flip1995
...
Detect usage of custom floating-point abs implementation
Closes #5224
changelog: Enhance [`suboptimal_flops`] lint to detect manual implementations of the `abs` method
2020-03-04 10:53:03 +00:00
Shotaro Yamada
246709f89e
run-rustfix
2020-03-04 17:37:01 +09:00
Shotaro Yamada
45f61ead2c
Lint if let Some
in question_mark lint
2020-03-04 17:24:12 +09:00
ThibsG
2aa14c9beb
Add restrictive pat use in full binded struct
2020-03-04 09:11:07 +01:00
JarredAllen
fe342f3291
Ran cargo dev fmt
2020-03-03 18:06:59 -08:00
JarredAllen
f8e949fa1c
Recommended changes from flip1995
2020-03-03 15:52:53 -08:00
Matthias Krüger
94867fbbb8
use question mark operator
2020-03-03 15:13:25 +01:00
Yuki Okushi
3d44ad2e32
Use try_eval_usize
over eval_usize
2020-03-03 21:40:24 +09:00
bors
b96c3ca811
Auto merge of #5259 - flip1995:lang_items, r=phansch
...
Use lang items instead of get_trait_def_id where possible
changelog: none
2020-03-03 11:46:21 +00:00
bors
f44181e799
Auto merge of #5047 - flip1995:use_debug, r=phansch
...
Don't trigger use_debug lint in Debug impl
Fixes #5039
changelog: Don't trigger [`use_debug`] lint in Debug impl
2020-03-03 11:32:51 +00:00
bors
5d3e3e1a9e
Auto merge of #5250 - mlegner:unused_fp, r=flip1995
...
Whitelist unused attribute for use items.
This PR whitelists the `unused` attribute with `use` items and adds a corresponding test case.
Fixes : #5229
changelog: none
2020-03-03 11:16:55 +00:00
flip1995
91042db2e8
Add path for display trait
2020-03-03 10:54:30 +01:00
flip1995
58cea334ec
Use lang items instead of get_trait_def_id where possible
2020-03-03 10:54:30 +01:00
flip1995
a628733ade
Don't lint debug formatting in debug impl
2020-03-03 10:48:08 +01:00
Yuki Okushi
f1d0791c3a
Rustup to rust-lang/rust#69469
2020-03-03 04:53:42 +09:00
mlegner
8669be56c4
Whitelist unused attribute for use items.
2020-03-02 10:22:05 +01:00
JarredAllen
0d584f3ff7
Fix one last test issue
2020-03-01 23:11:29 -08:00
JarredAllen
d88750371d
Refactor suggested by krishna-veerareddy
2020-03-01 22:37:37 -08:00
JarredAllen
0a6d299409
Fixed compile error from merging
2020-03-01 13:12:56 -08:00
JarredAllen
91a1cd562a
Merge branch 'master' of github.com:rust-lang/rust-clippy
2020-03-01 12:48:22 -08:00
Yuki Okushi
78dc48ea50
Rustup to rust-lang/rust#69579
2020-03-01 23:32:49 +09:00
Yuki Okushi
4253aa7137
Rustup to rust-lang/rust#69592
2020-03-01 12:23:33 +09:00
JarredAllen
bfa2691559
Run cargo dev fmt
2020-02-29 18:51:39 -08:00
JarredAllen
028cddb956
Finished checking for cases of absolute values
2020-02-29 13:46:59 -08:00
JarredAllen
5a21661ce5
Some bugfixing
2020-02-28 12:40:13 -08:00
JarredAllen
ce0dc9b70e
Created floating point abs lint and test, but not yet run
2020-02-27 22:31:41 -08: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
e94a167508
Rename mul_add
test file and add general improvements
2020-02-23 22:20:34 -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
bc706e3ba9
Fix powi
suggestion and add general improvements
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 Sai Veera Reddy
bc03f465c3
Remove lint for logarithm division identity
2020-02-23 22:20:34 -08:00
Krishna Veera Reddy
fd2506bcbf
Add type suffixes to unsuffixed method receiver suggestions
2020-02-23 22:20:34 -08:00
Krishna Veera Reddy
de07c84903
Detect usage of (x + 1).ln()
and suggest x.ln_1p()
instead
2020-02-23 22:20:34 -08:00
Krishna Veera Reddy
de79733924
Lint expressions of the form x.log(b) / y.log(b)
2020-02-23 22:20:33 -08:00
Krishna Veera Reddy
9520d3dfa4
Suggest usage of powi
method when applicable
2020-02-23 22:20:33 -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
Yuki Okushi
036ec5b63d
Rustup to rust-lang/rust#69366
2020-02-24 13:33:04 +09:00
Krishna Sai Veera Reddy
049079856b
Prevent missing_const_for_fn
on functions with const generic params
...
`const` functions cannot have const generic parameters so prevent the
`missing_const_for_fn` lint from firing in that case.
2020-02-21 19:56:44 -08:00
flip1995
4dd2252b17
Fix suggestion for weird formattings
2020-02-21 11:14:19 +01:00
flip1995
b562a519e6
Don't use use ty::TyKind::*
2020-02-21 11:14:18 +01:00
flip1995
8472ecda0f
Fix fallout
2020-02-21 11:14:18 +01:00
flip1995
f4f781d5cf
Filter prelude glob imports
2020-02-21 11:14:17 +01:00
flip1995
06a6189376
Move enum_glob_use lint into wildcard_imports pass
2020-02-21 11:14:17 +01:00
flip1995
3f5ed28524
Let's do it the easy way
...
Queries are cool, but too hard to find.
2020-02-21 11:14:16 +01:00
flip1995
4229dbcf33
Run update_lints
2020-02-21 11:14:16 +01:00
flip1995
ba1d50cec1
Implement wildcard_imports lint
2020-02-21 11:02:25 +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
bors
8fbb23f254
Auto merge of #5213 - JohnTitor:warm-return-ty, r=flip1995
...
Use generator own DefId
Fixes #5207
changelog: Fix ICE in `missing_errors_doc`
2020-02-21 08:27:37 +00:00
bors
3fc24192a5
Auto merge of #5200 - nipunn1313:unneeded_field_pattern, r=flip1995
...
Move unneeded_field_pattern to restriction group
Fixes #1741
changelog: Move unneeded_field_pattern to pedantic group
2020-02-21 08:14:30 +00:00
Yuki Okushi
8abe4365f3
Use generator own DefId
2020-02-21 16:24:58 +09:00
Krishna Sai Veera Reddy
219c94d028
Separate out lint to check lossy whole number float literals
2020-02-20 22:33:36 -08:00
Krishna Sai Veera Reddy
ce896ae96d
Rustup to rust-lang/rust#69072
2020-02-20 21:20:49 -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
Shotaro Yamada
9d254545f3
Migrate to generic dataflow
2020-02-20 03:21:18 +09:00
Shotaro Yamada
1c5c054e4c
Rename for clarity
2020-02-20 03:21:18 +09:00
Yuki Okushi
79c0cf0cc9
Rustup to rust-lang/rust#69194
2020-02-19 10:43:49 +09:00
Yuki Okushi
aa4cf72f28
Rustup to rust-lang/rust#69181
2020-02-19 07:33:19 +09:00
Krishna Sai Veera Reddy
533422fcce
Add LOG2_10
and LOG10_2
to approx_const
lint
2020-02-18 08:05:00 -08:00
Yuki Okushi
06cb96ed72
Clean up imports
2020-02-18 22:37:45 +09:00
Yuki Okushi
f4b80394d7
Use Vec::with_capacity()
as possible
2020-02-18 22:37:45 +09:00
Jon Gjengset
e2fc801ad5
needless_doctest_main: False positive for async fn
...
Fixes #5188 .
2020-02-17 13:47:45 -05:00
daxpedda
ea5ac40a24
Remove use of TyKind
.
2020-02-17 14:43:39 +01:00
daxpedda
8e2dab3b3c
Use if_chain
.
2020-02-17 14:43:38 +01:00
daxpedda
d8716f5a3f
Fix ICE.
2020-02-17 14:43:38 +01:00
daxpedda
0ee393cf01
Add tests and improve checks.
2020-02-17 14:43:38 +01:00
daxpedda
0b168c693a
Add Future
detection for missing_errors_doc
.
2020-02-17 14:43:32 +01:00
Yuki Okushi
f56e8b7eb4
Rename FunctionRetTy
to FnRetTy
2020-02-17 19:07:08 +09:00
Krishna Sai Veera Reddy
45936a6e26
Uplift excessive_precision
to the correctness category
2020-02-17 00:17:26 -08:00
Krishna Sai Veera Reddy
0532f3e521
Add lint to detect lossy float literals
2020-02-17 00:05:50 -08:00
Yuki Okushi
d488218ec1
Reduce pulldown-cmark size
2020-02-17 13:39:48 +09:00
bors
ba246c8262
Auto merge of #5183 - JohnTitor:fix-fp-import, r=matthiaskrgr
...
Don't lint `single_component_path_imports` in macros
Fixes #5154
changelog: Fix false positive in `single_component_path_imports`
2020-02-17 03:33:01 +00:00
Yuki Okushi
09165ff576
Don't lint single_component_path_imports
in macros
2020-02-17 11:13:42 +09:00
Yuki Okushi
4480ec5b71
Rustup to rust-lang/rust#67953
2020-02-17 11:07:26 +09:00
Matthew Jasper
787398aa53
Avoid using regions from TypeckTables
...
These regions will all be `ReErased` soon.
2020-02-15 16:24:49 +00:00
bors
779b6aeaa6
Auto merge of #4809 - iankronquist:patch-1, r=flip1995
...
Typo in literal_representation.rs
Octal numbers can't have 8 in them ;)
changelog: none
2020-02-15 15:12:14 +00:00
flip1995
4a9bfe4184
Let update_lints also generate the internal lints
2020-02-14 14:37:56 +01:00
Matthias Krüger
fa0ad30465
deps: update pulldown-cmark from 0.6 to 0.7
2020-02-13 22:01:26 +01:00
bors
96c2e62d57
Auto merge of #5168 - lily-commure:chars_next_style, r=flip1995
...
Reclassify chars_next_cmp as a style lint.
This makes it consistent with chars_last_cmp.
changelog: none
2020-02-13 12:54:28 +00:00
Yuki Okushi
f77158bc14
Fix false positive in zero_prefixed_literal
2020-02-13 14:39:29 +09:00
Lily Chung
385fd7cd0a
change in the right place, run update_lints
2020-02-12 17:03:49 -08:00
flip1995
57b636422a
Rustup to rust-lang/rust#68725
2020-02-10 15:59:21 +01:00
bors
c066807a70
Auto merge of #5148 - krishna-veerareddy:issue-5147-option-env-unwrap, r=flip1995
...
Add `option-env-unwrap` lint
changelog: Add `option-env-unwrap` lint
Fixes #5147
2020-02-10 08:08:53 +00:00
Krishna Sai Veera Reddy
46bd185e32
Rustup to rust-lang/rust#68911
2020-02-09 14:44:17 -08:00
Krishna Sai Veera Reddy
a3a1587a1c
Allow option-env-unwrap
within external macros
2020-02-09 10:58:08 -08:00
Krishna Sai Veera Reddy
0e5ba2f0e7
Account for expect
being used to unwrap Option
2020-02-09 08:54:23 -08:00
Lzu Tao
5328b5d667
Rustup "index ReEmpty by universe"
2020-02-09 15:31:47 +07:00
Krishna Sai Veera Reddy
be1bc571c3
Add option-env-unwrap
lint
2020-02-08 16:44:35 -08:00
bors
b5e6d6db41
Auto merge of #5134 - flip1995:snippet_block, r=phansch
...
Make it possible to correctly indent snippet_block snippets
This adds a `indent_relative_to` arg to the `{snippet,expr}_block` functions. This makes it possible to keep the correct indentation of block like suggestions.
In addition, this makes the `trim_multiline` function private and adds a `indent_of` function, to get the indentation of the first line of a span.
The suggestion of `needless_continue` cannot be made auto applicable, since it would be also necessary to remove code following the linted expression. (Well, maybe it is possible, but I don't know how to do it. Expanding the suggestion span to the last expression, that should be removed didn't work)
changelog: Improve suggestions, when blocks of code are involved
2020-02-06 21:41:50 +00:00
flip1995
9897927504
Rustup to rust-lang/rust#68788
2020-02-06 20:33:39 +01:00
flip1995
e23881e131
Rename ctx->cx in needless_continue
2020-02-06 19:15:01 +01:00
flip1995
4068ff4d8a
Improve help message in needless_continue
2020-02-06 19:15:01 +01:00
flip1995
c7979d3515
Fix rebase fallout
2020-02-06 19:15:01 +01:00
flip1995
250c1842b1
Document the indent_relative_to arg of snippet_block
2020-02-06 19:15:01 +01:00
flip1995
cd0f0946cf
Move tests to the end of the file in utils mod.rs
2020-02-06 19:15:00 +01:00
flip1995
f1a72e992d
Update needless_continue stderr
2020-02-06 19:13:46 +01:00
flip1995
8e15985827
Rewrite suggestion generation of needless_continue
2020-02-06 19:13:46 +01:00
flip1995
19f08c200e
Make block_in_if_condition auto applicable
2020-02-06 19:13:46 +01:00
flip1995
5fd22b3f93
Optionally indent snippet_block relative to an Expr
2020-02-06 19:13:45 +01:00
bors
a6f310ed0e
Auto merge of #5139 - lzutao:linecount, r=llogiq
...
dev: Use bytecount for faster line count
changelog: none
2020-02-06 15:31:01 +00:00
bors
75e983a518
Auto merge of #5125 - Areredify:too_many_bools, r=flip1995
...
Port mitsuhiko's excessive bools lints
Closes #4 .
changelog: add `struct_excessive_bools` and `fn_params_excessive_bools` lints.
I moved is_trait_impl_item check because at first I implemented it as a late pass for some reason but then I realized it's actually an early lint. But it's a useful function to have, should I move it into a separate pr?
2020-02-06 14:47:14 +00:00
Lzu Tao
8794e41728
dev: Use bytecount for faster line count
2020-02-06 21:39:15 +07:00
bors
a3135ba131
Auto merge of #5132 - JohnTitor:fix-fp-in-unwrap-lint, r=flip1995
...
Do not lint `unnecessary_unwrap` in external macros
Fixes #5131
I think we shouldn't lint `{panicking, unnecessary}_unwrap` in macros, not just `assert!`.
changelog: Fix false positive in `unnecessary_unwrap`
2020-02-06 14:17:35 +00:00
Areredify
338fb7a3e9
add excessive bools lints
2020-02-05 20:54:58 +03:00
Areredify
8e28b2fdf1
move is_trait_impl_item check from functions.rs to utils
2020-02-05 18:11:20 +03:00
bors
c881aca282
Auto merge of #5135 - lzutao:config, r=flip1995
...
Few improvement to `utils::conf` module
* Fix a few typos
* Handle Option<&Path> early
* Use `env::var_os` when possible
changelog: none
2020-02-05 09:58:15 +00:00
Lzu Tao
32924c6ce0
Few improvement to utils::conf
module
...
* Fix a few typos
* Handle Option<&Path> early
* Use `env::var_os` when possible
2020-02-05 09:06:34 +07:00
ThibsG
00904cb100
Manage macros case + move to MaybeIncorrect when binding values
2020-02-04 22:54:42 +01:00
ThibsG
b29aacfec8
Add wild and struct handling
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
Yuki Okushi
19ce66c1c1
Re-cover use of unnecessary unwraps in macros
2020-02-05 05:38:26 +09:00
ThibsG
3445d41f07
Add new lint: match with a single binding statement
...
- Lint name: MATCH_SINGLE_BINDING
2020-02-04 01:06:16 +01:00
Yuki Okushi
514b1bc2af
Do not lint unnecessary_unwrap
in macros
2020-02-04 04:01:42 +09:00
bors
a39589480b
Auto merge of #5129 - JohnTitor:use-checked-sub, r=flip1995
...
Use `checked_sub` to avoid index out of bounds
(Fixes) #4681 (possibly)
The issue likely occurs due to `lit_snip.len() < suffix.len() + 1`. You can see similar backtrace to change it to `lit_snip.len() - suffix.len() - 1000` or something then run `cargo test --release`.
But I couldn't come up with the test so I'd leave the issue open if we want.
changelog: Fix potential ICE in `misc_early`
2020-02-03 16:47:25 +00:00
Areredify
66ad544175
improve 'iter_nth_zero' documentation
2020-02-03 15:44:55 +03:00
Yuki Okushi
bae129ac69
Use checked_sub
to avoid index out of bounds
2020-02-03 15:19:54 +09:00
bors
c6b87ef54a
Auto merge of #5119 - JohnTitor:tweak-doc, r=flip1995
...
Tweak documentation in `multiple_crate_versions`
This example isn't reproducible now since `ctrlc` upgrades `winapi` to `0.3.x` in `3.1.1`. We should pin their versions to trigger lint correctly.
changelog: none
2020-02-02 17:48:12 +00:00
Yuki Okushi
f63a6a5baf
Rustup to rust-lang/rust#68133
2020-02-02 06:56:27 +09:00
Yuki Okushi
0f67a7ecb5
Pin versions to trigger lint correctly
2020-02-01 20:11:32 +09:00
flip1995
5ba4aa8eba
Move debug_assertions_with_mut_call to nursery
2020-01-31 10:57:52 +01:00
flip1995
9fbd7f478e
Don't trigger debug_assert_with_mut_call
on .await
2020-01-31 10:39:05 +01:00
flip1995
b31a3dff48
Small refactor of mutable_debug_assertions
2020-01-31 10:39:04 +01:00
bors
8e9089e454
Auto merge of #5110 - Aloso:patch-1, r=flip1995
...
Fix syntax highlighting of code fences
The documentation for RESULT_EXPECT_USED includes this code:
let res: Result<usize, ()> = Ok(1);
res?;
# Ok::<(), ()>(())
Because the code fence didn't start with `rust`, the code wasn't highlighted and the line starting with `#` was displayed on the website. This is now fixed.
EDIT: I noticed that highlighting for some other lints is broken as well. It only works if the code fence looks like this:
````markdown
```rust
// ..
```
````
However, many code blocks were ignored. I un-ignored most code blocks and made them compile by adding hidden code with `#`. While doing so, I found two mistakes:
```rust
opt.map_or(None, |a| a + 1)
// instead of
opt.map_or(None, |a| Some(a + 1))
```
and
```rust
fn as_str(self) -> &str
// instead of
fn as_str(self) -> &'static str
```
changelog: none
2020-01-30 23:24:53 +00:00
Ludwig Stecher
1f600f3f9a
Un-ignore most code blocks to render correctly on website, correct mistakes
2020-01-30 23:44:37 +01:00
Ludwig Stecher
58da5ba6db
Fix code formatting for more lints
2020-01-30 22:12:00 +01:00
Ludwig Stecher
f0dc98160b
Fix syntax highlighting of code fence
...
The documentation for RESULT_EXPECT_USED includes this code:
let res: Result<usize, ()> = Ok(1);
res?;
# Ok::<(), ()>(())
Because the code fence didn't start with `rust`, the code wasn't highlighted and the line starting with `#` was displayed on the website. This is now fixed.
2020-01-30 21:55:30 +01:00
Areredify
63ab7a5e8c
lint all guard types, not just lock functions
2020-01-30 18:46:22 +03: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
ac9f019fbf
Reformat code.
2020-01-30 00:23:47 +08:00
xiongmao86
512efbea23
Declare lint and implement lint logic.
2020-01-30 00:21:29 +08:00
Yuki Okushi
66524c5be0
Rustup to rust-lang/rust#68512
2020-01-29 17:15:56 +09:00
Yuki Okushi
f5e86d6894
Rename span_note_and_lint
to span_lint_and_note
2020-01-27 11:26:42 +09:00
Yuki Okushi
f60f12f71f
Rename span_help_and_lint
to span_lint_and_help
2020-01-27 11:17:58 +09:00
bors
4f65bec39a
Auto merge of #5084 - JohnTitor:clean-up-span-lint, r=flip1995
...
Clean up `span_lint` in `methods/mod.rs`
Uses `span_help_and_lint` instead of `span_lint` and `span_lint_and_sugg` instead of `span_lint_and_then`.
changelog: none
2020-01-26 15:28:39 +00:00
Eduard-Mihai Burtescu
0e52a0ed6d
Don't use ExpnKind::descr to get the name of a bang macro.
2020-01-26 03:12:44 +02:00
Yuki Okushi
4b133f2867
Apply review comments
2020-01-26 07:01:16 +09:00
bors
fd6f609f64
Auto merge of #5083 - Areredify:issue-4399, r=flip1995
...
dont fire `possible_missing_comma` if intendation is present
Closes #4399
changelog: dont fire `possible_missing_comma` if intendation is present
I suspect there is already a utils function for indentation (but searching indent didn't yield a function for that), and my solution is certainly not universal, but it's probably the best we can do.
2020-01-25 17:47:54 +00:00
Mikhail Babenko
a234aef084
dont fire possible_missing_comma if intendation is present
2020-01-25 20:16:05 +03:00
bors
6b5419412e
Auto merge of #5081 - Areredify:vec_box_threshold, r=flip1995
...
add size parameter for `vec_box` lint
changelog: add size threshold for the `vec_box` lint, currently 4096 bytes (one page) (subject to change). Closes #3547 .
diff is a little bit confusing due to some refactoring (moving free functions to lint struct functions), relevant portion is [this](https://github.com/rust-lang/rust-clippy/compare/master...Areredify:vec_box_threshold?expand=1#diff-1096120ca9143af89dcc9175ea92b54aR294-R298 ). In hindsight should've been different commits, but oh well.
2020-01-25 16:11:43 +00:00
Mikhail Babenko
2b7bc260de
add size parameter for lint
2020-01-25 18:06:52 +03:00
bors
87597b5a42
Auto merge of #5087 - Areredify:issue-4905, r=phansch
...
improve `empty_enum` documentation
closes #4905
changelog: improve `empty_enum` help message and documentation.
2020-01-24 22:30:07 +00:00
Mikhail Babenko
634774b89b
don't fire empty_loop in no_std crates
2020-01-24 14:42:24 +03:00
Mikhail Babenko
199ae1714e
improve empty_enum documentation
2020-01-24 14:37:16 +03:00
Yuki Okushi
2dc73c45d5
Clean up methods/mod.rs
2020-01-24 17:04:37 +09:00
bors
2c7cfa8321
Auto merge of #5027 - sinkuu:vectored_io, r=phansch
...
Lint vectored IO in unused_io_amount lint
`read_vectored` & `write_vectored` require handling returned value likewise non-vectored methods. https://github.com/rust-lang/rust/issues/68041
---
changelog: lint vectored IO in `unused_io_amount` lint
2020-01-24 06:44:09 +00:00
bors
3237b7a69f
Auto merge of #5082 - Areredify:issue-4980, r=flip1995
...
disable let_underscore_must_use in external macros
changelog: disable let_underscore_must_use in external macros
Closes #4980
2020-01-23 18:29:28 +00:00
Mikhail Babenko
fef3657100
disable let_underscore_must_use in external macros
2020-01-23 20:02:34 +03:00
Areredify
796958c7e2
add option_as_ref_deref
lint
2020-01-23 16:12:16 +03:00
Yuki Okushi
a7d58edf27
Ignore macros with !
operators in eq_op
2020-01-22 16:48:00 +09:00
Yuki Okushi
7ce9b8437d
Rustup to rust-lang/rust#68140
2020-01-22 07:26:07 +09: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
bors
eca0d8e5d0
Auto merge of #5067 - JohnTitor:lint-skip-while-next, r=flip1995
...
Add `skip_while_next` lint
Fixes #4036
changelog: Add `skip_while_next` lint
2020-01-20 17:28:38 +00:00
bors
32949da78e
Auto merge of #5070 - JohnTitor:suspicious-map-doc, r=flip1995
...
Improve `suspicious_map`documentation
Fixes #4793
changelog: none
2020-01-20 12:12:03 +00:00
Yuki Okushi
bec5b69e45
Apply review comment
2020-01-20 21:07:31 +09:00
Yuki Okushi
f8034e0bc6
Improve suspicious_map
documentation
2020-01-20 15:05:40 +09:00
Yuki Okushi
fdda3c3f25
Tweak wording in assertions_on_constants
2020-01-20 11:52:58 +09:00
Yuki Okushi
95c369fa91
Add skip_while_next
lint
2020-01-20 10:56:02 +09:00
bors
f7b3e4f29c
Auto merge of #5056 - rust-lang:dissasociate-mut-key, r=flip1995
...
Avoid mut_key on types of unknown layout
This fixes #5020 by requiring a known layout for the key type before linting. Edit: This fixes #5043 , too.
changelog: none
2020-01-19 14:41:28 +00:00
Andre Bogus
59fd637ba1
Avoid mut_key on types of unknown layout
2020-01-19 14:49:18 +01:00
Yuki Okushi
c9f8d03f42
Treat more strange pattern
2020-01-19 21:14:47 +09:00
Yuki Okushi
7e76a19664
Apply review comments
2020-01-19 10:14:03 +09:00
Yuki Okushi
ce06ba3d30
Run update_lints
2020-01-19 10:06:08 +09:00
Yuki Okushi
aab64a21cc
Reduce span range
2020-01-19 10:06:08 +09:00
Yuki Okushi
ae872fe1c7
Rename ok_if_let
to if_let_some_result
2020-01-19 10:06:08 +09:00
Yuki Okushi
9e55424bdc
Apply review comments
2020-01-19 10:06:08 +09:00
Yuki Okushi
9035264a8f
Add suggestion in if_let_some_result
2020-01-19 10:06:08 +09:00
bors
0a7003ecf0
Auto merge of #5065 - matthiaskrgr:rustup_28, r=matthiaskrgr
...
rustup https://github.com/rust-lang/rust/pull/67712
slice_patterns have been stabilized.
changelog: none
2020-01-18 22:44:46 +00:00
Matthias Krüger
b2c4f09d77
rustup https://github.com/rust-lang/rust/pull/67712
...
slice_patterns have been stabilized.
2020-01-18 23:43:28 +01:00
bors
0964b8d192
Auto merge of #5046 - JohnTitor:order-nonminimal-bool, r=flip1995
...
Keep the ordering in `nonminimal_bool` lint
I believe it shouldn't cause any regression but feel free to let me know if you have a doubtful example.
Also, splits up `booleans` ui test.
Fixes #5045
changelog: none
2020-01-18 19:51:46 +00:00
bors
ee06aa990f
Auto merge of #5063 - JohnTitor:allow-correctly, r=flip1995
...
Allow `unused_self` lint at the function level
Another approach of #5062 .
Fixes #5053
changelog: Allow `unused_self` lint at the function level
2020-01-18 16:58:30 +00:00
Yuki Okushi
ff0a22d99f
Allow unused_self
lint at the function level
2020-01-18 21:05:42 +09:00
Andre Bogus
ff5fb19bbd
Downgrade range_plus_one to pedantic
2020-01-18 09:40:36 +01:00
Yuki Okushi
e72f0e61c6
Rustup to rust-lang/rust#68204
2020-01-18 14:39:18 +09:00
Brad Sherman
32337a9b58
Add lint for default lint description
...
- Lint for any new lints that have the default lint description
from the automation
2020-01-15 21:23:08 -06:00
bors
be09bb47db
Auto merge of #5034 - ThibsG:MatchWildErrArmImprove5024, r=flip1995
...
Match wild err arm improvements
This lint should trigger on other identifiers which have `_` prefix (such as `_e`) and only if they are unused in the panic block.
_Note_: the `is_unused` function is greatly inspired from `pat_is_wild` function in [loops lints](43ac9416d9/clippy_lints/src/loops.rs (L1689)
).
I've been considering doing some refactoring, maybe in utils. Maybe this PR or a new one. What do you think ?
fixes #5024
changelog: none
2020-01-15 21:17:21 +00:00
Andre Bogus
2797b64f7e
Omit doc safety/errors header checking for main
2020-01-14 18:20:56 +01:00
bors
c24a42289b
Auto merge of #4543 - xiongmao86:issue4503, r=flip1995
...
Fix issue4503
Fixes #4503 .
changelog: Add a lint checking user are using FileType.is_file() method and suggest using !FileType.is_dir().
- [x] Followed [lint naming conventions][lint_naming]
- [x] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `./util/dev update_lints`
- [x] Added lint documentation
- [x] Run `./util/dev fmt`
2020-01-13 22:09:39 +00:00
Yuki Okushi
73e525019d
Fix the ordering on nonminimal_bool
2020-01-14 07:08:45 +09:00
ThibsG
44fb8b5e88
Extract visitor to utils
2020-01-13 16:50:11 +01:00
ThibsG
d3c76b5b2a
Change note message
2020-01-13 16:25:35 +01:00
ThibsG
95cc500e9d
Fix formatting
2020-01-13 16:25:35 +01:00
ThibsG
e5c9073f9c
Better binding name on Err for note
2020-01-13 16:25:35 +01:00
ThibsG
f79c47f28d
Match underscore-prefixed variable also
2020-01-13 16:25:35 +01:00
Yuki Okushi
ce1c6b285d
Rustup to rust-lang/rust#68045
2020-01-13 21:55:57 +09:00
xiongmao86
2b477f361e
Update lints again.
2020-01-12 19:54:17 +08:00
xiongmao86
77c48ca341
Fix grammar error.
2020-01-12 19:54:17 +08:00
Rui
1018b78f41
Update clippy_lints/src/methods/mod.rs
...
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2020-01-12 19:54:17 +08:00
xiongmao86
8d3cc6b8a9
Change lint message.
2020-01-12 19:54:17 +08:00
xiongmao86
2909bc372f
./util/dev update_lints.
2020-01-12 19:54:17 +08:00
Rui
a73822d3b9
Fix documents and messages.
...
Update clippy_lints/src/methods/mod.rs
2020-01-12 19:54:17 +08:00
xiongmao86
8d333a3cbb
Extend spans to include !.
2020-01-12 19:54:17 +08:00
xiongmao86
3c59eaf91c
Add lint logic.
2020-01-12 19:54:17 +08:00
xiongmao86
96334d0d7c
Declare lint.
2020-01-12 19:54:17 +08:00
Yuki Okushi
2f4b105863
Remove references
2020-01-12 05:20:18 +09:00
Yuki Okushi
8a3a0ea2ea
Rustup to rust-lang/rust#67000
2020-01-12 03:41:54 +09:00
Yuki Okushi
3bdf404076
Apply review comments
2020-01-11 23:21:09 +09:00
Yuki Okushi
39947992b5
Rustup to rust-lang/rust#67806
2020-01-11 21:50:00 +09:00
Yuki Okushi
10cf141ebb
Apply review comments
2020-01-11 19:39:43 +09:00
Yuki Okushi
8daa2784c7
Rustup to rust-lang/rust#68101
2020-01-11 09:06:09 +09:00
Yuki Okushi
1d7d4e9217
Rustup to rust-lang/rust#67258
2020-01-11 09:05:51 +09: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
Shotaro Yamada
b3971fdd5d
Lint vectored IO in unused_io_amount lint
2020-01-09 23:46:55 +09: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
e58cfac458
Rustup to rust-lang/rust#67979
2020-01-09 16:43:51 +09:00
Yuki Okushi
c24251b5fd
Rustup to rust-lang/rust#67781
2020-01-09 09:22:16 +09:00
bors
0da0ae3aa6
Auto merge of #5022 - flip1995:useless_attr, r=phansch
...
Fix useless_attribute suggestion
Fixes #5021
changelog: Fix [`useless_attribute`] suggestion, which tripped rustfix
2020-01-08 20:28:19 +00:00
flip1995
9ea17d42a7
Fix useless attribute suggestion
2020-01-08 17:47:01 +01:00
bors
52b9e704c6
Auto merge of #5017 - sinkuu:mir_no_opt_fallout, r=flip1995
...
Fix redundant_clone lint not working with PathBuf and OsString
https://github.com/rust-lang/rust-clippy/pull/4825 diabled MIR optimization in clippy, including `rustc_mir::transform::InstCombine` which reduces `&(*x)` to `x`. This PR tries to unwrap `&*` when looking into `mir::Rvalue`s.
Fixes #5014 .
---
changelog: fixed `redundant_clone` lint not working with `PathBuf` and `OsString`
2020-01-08 12:09:45 +00:00
bors
c789caa454
Auto merge of #5015 - krishna-veerareddy:change-float-to-int-transmute-category, r=flip1995
...
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.
changelog: Move `transmute_float_to_int` out of nursery
2020-01-08 08:42:46 +00:00
Yuki Okushi
787106c380
Normalize lint messages in cast_precision_loss
2020-01-08 16:36:02 +09:00
Yuki Okushi
fa33681d5c
Rustup to rust-lang/rust#67970
2020-01-08 15:42:54 +09:00
Shotaro Yamada
99eec3f54f
Fix redundant_clone
2020-01-08 14:18:00 +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
58deaad42d
Handle case for non-exhaustive enums
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
649af71f9e
Change group and use only func call
2020-01-07 18:48:16 +01:00
ThibsG
8ec32175fa
Remove useless parameters in func call
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
5ac08b0cc9
Normalize lint messages
2020-01-07 18:26:55 +09:00
bors
cdd134764a
Auto merge of #5010 - lzutao:recurse-remove_blocks, r=phansch
...
Make utils::remove_blocks non-recursive
changelog: none
2020-01-07 07:46:00 +00:00
Lzu Tao
3801d216e2
Make utils::remove_blocks non-recursive
2020-01-07 10:50:35 +07: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
Yuki Okushi
2213989a01
Do not trigger let_and_return
lint on macros
2020-01-07 05:26:20 +09:00
Yuki Okushi
2f2eaf8b7e
Rustup to rust-lang/rust#67886
2020-01-07 01:46:33 +09:00
bors
732825dcff
Auto merge of #4996 - JohnTitor:rustup, r=matthiaskrgr
...
Rustup to rust-lang/rust#67803 and rust-lang/rust#67137
changelog: none
2020-01-05 08:41:37 +00:00
Yuki Okushi
17cfc77bd6
Rustup to rust-lang/rust#67137
2020-01-05 15:50:06 +09:00
Yuki Okushi
07f061563d
Rustup to rust-lang/rust#67803
2020-01-05 15:50:06 +09:00
Andre Bogus
539cd25262
External macro check for missing_*_doc
2020-01-04 20:19:14 +01: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
Brad Sherman
8ef53bf196
Fix existing iter-nth-zero violations
2020-01-04 09:00:54 -06:00
Philipp Hansch
c5178e82b4
Rustup to https://github.com/rust-lang/rust/pull/67853
...
Specifically caused by https://github.com/rust-lang/rust/pull/67786
2020-01-04 11:30:03 +01:00
bors
fa9b85d4df
Auto merge of #4881 - krishna-veerareddy:issue-4871-use-mem-take, r=flip1995
...
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`.
Fixes issue #4871
changelog: Added lint for [`mem_replace_with_default`]
2020-01-04 08:09:43 +00:00
Yuki Okushi
1102b87e3a
Remove use of try!
from documentation
2020-01-04 13:47:01 +09:00
Andre Bogus
47972cdf12
No #[no_mangle] must_use_candidate functions
2020-01-03 17:21:36 +01:00
bors
2e8c3c3e9e
Auto merge of #4975 - JohnTitor:fix-4968, r=phansch
...
Fix ICE on `unsound_collection_transmute`
Fixes #4968
Check if `Ty`s are normalizable. It might show hidden false negative, I'm not sure.
Also, the regression tests are placed on two dirs, so move them to `/crashes`. I think it will be easier to find the right place.
changelog: Fix ICE on `unsound_collection_transmute`
2020-01-03 08:48:05 +00:00
bors
304edf39c3
Auto merge of #4978 - mikerite:fix-4958, r=phansch
...
Fix bad `explicit_into_iter_loop` suggestion
Fixes #4958
changelog: Fix bad `explicit_into_iter_loop` suggestion
2020-01-03 05:59:19 +00:00
Yuki Okushi
bf67fcf5a9
Move is_normalizable
into utils
2020-01-02 11:48:06 +09:00
Michael Wright
ea829bd8c6
Fix bad explicit_into_iter_loop
suggestion
...
Fixes #4958
2020-01-01 07:09:09 +02:00
Krishna Veera Reddy
84a60c3186
Prevent replace_consts
lint within match patterns
...
Currently `replace_consts` lint applies within match patterns but
the suggestion is incorrect as function calls are disallowed in
them. To fix this we prevent the lint from firing within patterns.
2019-12-31 10:33:15 -08:00
Krishna Veera Reddy
42e4595d3a
Indicate anonymous lifetimes for types
2019-12-31 09:22:35 -08:00
Krishna Veera Reddy
c09e79e226
Lint within internal macros without a suggestion
2019-12-31 09:22:35 -08:00
Krishna Veera Reddy
aa66f760c3
Destructure mem:replace
arguments
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
26812f733d
Prevent mem_replace_with_default
lint within macros
...
Also added test cases for internal and external macros.
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
Yuki Okushi
f922812541
Fix ICE due to normalization failure
2019-12-31 20:55:11 +09:00
Yuki Okushi
bf08998b5c
Use is_empty()
2019-12-31 16:50:43 +09:00
Yuki Okushi
9086b17e14
Rustup to rust-lang/rust#67707
2019-12-31 09:17:56 +09:00
bors
3036b0e6d5
Auto merge of #4970 - krishna-veerareddy:fix-replace-consts-documentation, r=flip1995
...
Fix `replace_consts` lint documentation
`replace_consts` lint no longer lints for the usage of
`ATOMIC_{SIZE}_INIT` and `ONCE_INIT` so removing any
occurences of them in the documentation.
changelog: Update `replace_consts` lint documentation
2019-12-30 17:28:57 +00:00
bors
cecaca3382
Auto merge of #4634 - m-ober:feature/2320-map-or, r=llogiq
...
Add real suggestion to option_map_unwrap_or
changelog: Add real suggestion to `option_map_unwrap_or`
Fixes #2320
2019-12-30 15:50:06 +00:00
Krishna Veera Reddy
f533b98121
Fix replace_consts
lint documentation
...
`replace_consts` lint no longer lints for the usage of
`ATOMIC_{SIZE}_INIT` and `ONCE_INIT` so removing any
occurences of them in the documentation.
2019-12-30 05:55:22 -08:00
Yuki Okushi
a4c201e6b4
Rustup to rust-lang/rust#66942
2019-12-30 13:02:10 +09:00
Yuki Okushi
cf76eb48de
Rustup to rust-lang/rust#67151
2019-12-29 12:39:46 +09:00
Micha Ober
c5046fdce5
Add real suggestion to option_map_unwrap_or
2019-12-28 23:24:45 +01:00
bors
6bf87d5bbf
Auto merge of #4964 - JohnTitor:fix-potential-ice, r=flip1995
...
Possibly fix an ICE on test
Fix a potential ICE on test with debug assertion, caused on rust-lang/rust#67661 .
r? @oli-obk
changelog: none
2019-12-28 18:41:38 +00:00
mgr-inz-rafal
a208906afb
Fixes for elided lifetimes
2019-12-28 17:14:19 +01:00
mgr-inz-rafal
f191e916bd
Add new lint (modulo_arithmetic)
2019-12-28 16:46:08 +01:00
Yuki Okushi
bca125935c
code review
2019-12-28 22:45:41 +09:00
Yuki Okushi
fbdb13cfb0
Possibly fix an ICE on test
2019-12-28 22:30:44 +09:00
Yuki Okushi
5962fffcfe
Suggest similar lint name on unknown_clippy_lints
2019-12-27 22:07:55 +09:00
Yuki Okushi
e2636729ec
Rustup to rust-lang/rust#66936
2019-12-27 16:13:53 +09:00
bors
b0c4744d57
Auto merge of #4956 - JohnTitor:decimal-lit-suffix, r=llogiq
...
Do not drop suffixes on `decimal_literal_representation`
Fixes #4763
changelog: Do not drop type suffixes on `decimal_literal_representation`
2019-12-25 19:39:13 +00:00
Yuki Okushi
b68e65b4da
Do not drop suffixes on decimal_literal_representation
2019-12-26 01:22:36 +09:00
Yuki Okushi
ad936389e1
Correct documentation for len_zero
2019-12-25 21:06:55 +09:00
bors
a68ef55dbf
Auto merge of #4947 - rust-lang:doc-main-extern-crate, r=flip1995
...
Avoid needless_doctest_main on 'extern crate'
This fixes #4927 .
r? @flip1995
changelog: none
2019-12-24 15:03:54 +00: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
Andre Bogus
129d0cd0f4
Avoid needless_doctest_main on 'extern crate'
2019-12-24 13:42:37 +01:00
Lzu Tao
652666b288
rustup "Add span information to ExprKind::Assign
"
2019-12-24 11:25:24 +07: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
bors
37b7970a7c
Auto merge of #4934 - illicitonion:exhaustive_match, r=flip1995
...
Update wildcard enum match lint for non_exhaustive enums
changelog: wildcard_enum_match_arm gives better suggestions for non_exhaustive enums
2019-12-23 17:00:38 +00:00
bors
b38b026a98
Auto merge of #4823 - Areredify:must_use_res, r=flip1995
...
Add `let_underscore_must_use` lint
changelog: closes #4812 , added a new `let_underscore_must_use` lint, moved `is_must_use_ty` to utils, added `is_must_use_fn` util function
2019-12-23 06:16:37 +00:00
bors
40881e7713
Auto merge of #4941 - lzutao:utils-mod, r=phansch
...
a few small cleanups
changelog: none
2019-12-23 06:00:54 +00:00
Yuki Okushi
d5316163b6
Rustup to rust-lang/rust#66877
2019-12-23 09:07:46 +09:00
Lzu Tao
185e608ae2
a few small cleanups
2019-12-23 05:28:23 +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
Mikhail Babenko
8b4a3b74e9
move is_must_use_ty to utils
2019-12-22 22:06:48 +03:00
flip1995
f6a5b608ef
Rustup to rust-lang/rust#66931
2019-12-22 15:56:34 +01:00
flip1995
9632e27487
Add <'_> where necessary
2019-12-22 15:42:41 +01:00
Daniel Wagner-Hall
4f4444c429
Remove trailling .s
2019-12-22 11:51:39 +00:00
bors
8723eb6035
Auto merge of #4937 - mikerite:fix-4824, r=phansch
...
Fix `map_clone` false positive
Don't lint when the item type is not a reference. `copied` only applies to references.
changelog: Fix `map_clone` false positive
2019-12-22 09:55:50 +00:00
bors
19dbb22032
Auto merge of #4930 - flip1995:unused_label, r=phansch
...
Deprecate unused_label lint
This lint was uplifted/turned into warn-by-default in rustc
Fixes #4925
changelog: Deprecate [`unused_label`] lint
2019-12-22 09:39:32 +00:00
Michael Wright
b15b977d76
Fix map_clone
false positive
...
Don't lint when the item type is not a reference. `copied` only applies
to references.
2019-12-22 11:26:51 +02:00
Daniel Wagner-Hall
c21b4ad7d4
Update wildcard enum match lint for non_exhaustive enums
2019-12-22 02:13:39 +00:00
Krishna Veera Reddy
91a491e68e
Reduce cognitive complexity lint span
...
Currently the cognitive complexity lint spans the entire function
body making it really difficult to read and refactor the code in
editors. To fix this we reduce the lint span to the function name.
2019-12-21 18:07:53 -08:00
Lzu Tao
d1ca5f1d7c
rustup "Merge ast::Mutability
and mir::Mutability
"
2019-12-21 18:38:45 +00: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