Commit graph

3591 commits

Author SHA1 Message Date
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