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
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
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
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