Commit Graph

813 Commits

Author SHA1 Message Date
mlegner
d14fdc0203
Move NumericLiteral to its own module. 2020-03-04 13:22:53 +01: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
Yuki Okushi
4253aa7137 Rustup to rust-lang/rust#69592 2020-03-01 12:23:33 +09: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
Yuki Okushi
06cb96ed72 Clean up imports 2020-02-18 22:37:45 +09:00
daxpedda
0ee393cf01
Add tests and improve checks. 2020-02-17 14:43:38 +01:00
Yuki Okushi
f56e8b7eb4 Rename FunctionRetTy to FnRetTy 2020-02-17 19:07:08 +09:00
Yuki Okushi
4480ec5b71 Rustup to rust-lang/rust#67953 2020-02-17 11:07:26 +09:00
flip1995
57b636422a
Rustup to rust-lang/rust#68725 2020-02-10 15:59:21 +01: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
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
5fd22b3f93
Optionally indent snippet_block relative to an Expr 2020-02-06 19:13:45 +01: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
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
Yuki Okushi
f63a6a5baf Rustup to rust-lang/rust#68133 2020-02-02 06:56:27 +09:00
Areredify
63ab7a5e8c lint all guard types, not just lock functions 2020-01-30 18:46:22 +03:00
Mikhail Babenko
d1f8621711 add lint 2020-01-30 16:48:56 +03: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
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
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
Mikhail Babenko
634774b89b don't fire empty_loop in no_std crates 2020-01-24 14:42:24 +03:00
Areredify
796958c7e2 add option_as_ref_deref lint 2020-01-23 16:12:16 +03:00
Yuki Okushi
7ce9b8437d Rustup to rust-lang/rust#68140 2020-01-22 07:26:07 +09: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
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
ThibsG
44fb8b5e88 Extract visitor to utils 2020-01-13 16:50:11 +01:00
Yuki Okushi
ce1c6b285d Rustup to rust-lang/rust#68045 2020-01-13 21:55:57 +09:00
xiongmao86
3c59eaf91c Add lint logic. 2020-01-12 19:54:17 +08: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
Yuki Okushi
e58cfac458 Rustup to rust-lang/rust#67979 2020-01-09 16:43:51 +09:00
flip1995
9ea17d42a7
Fix useless attribute suggestion 2020-01-08 17:47:01 +01:00
Yuki Okushi
fa33681d5c Rustup to rust-lang/rust#67970 2020-01-08 15:42:54 +09:00
Lzu Tao
3801d216e2 Make utils::remove_blocks non-recursive 2020-01-07 10:50:35 +07:00
Yuki Okushi
2f2eaf8b7e Rustup to rust-lang/rust#67886 2020-01-07 01:46:33 +09: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
Andre Bogus
47972cdf12 No #[no_mangle] must_use_candidate functions 2020-01-03 17:21:36 +01:00
Yuki Okushi
bf67fcf5a9 Move is_normalizable into utils 2020-01-02 11:48:06 +09:00