Matthias Krüger
f9c1acbc45
rustup https://github.com/rust-lang/rust/pull/71215/
2020-04-24 15:29:31 +02:00
flip1995
f31502f4bb
Only run (late) internal lints, when they are warn/deny/forbid
2020-04-22 20:51:58 +02:00
flip1995
14f596cb74
Only run cargo lints, when they are warn/deny/forbid
2020-04-22 20:32:37 +02:00
Andy Weiss
2dc8c083f5
Switch to matching against full paths instead of just the last element of the path
2020-04-21 21:07:43 -07:00
Eduardo Broto
00b4f2819f
Implement unsafe_derive_deserialize lint
2020-04-19 23:26:17 +02:00
Philipp Krones
98a244fc27
Formatting and naming
2020-04-19 20:40:25 +02:00
Philipp Krones
41115d994a
Formatting and naming
2020-04-19 20:38:07 +02:00
xiongmao86
d7f1a1ed2b
Change note_span argument for span_lint_and_note.
2020-04-18 18:29:36 +08:00
xiongmao86
cf4e35339b
Add an Option<Span> argument to span_lint_and_help.
2020-04-18 18:28:29 +08:00
xiongmao86
bdd32e7700
Implement collapsible_span_lint_calls lint.
2020-04-18 18:13:50 +08:00
Philipp Hansch
870ae36f85
Cleanup: Rename 'db' variable to 'diag'
2020-04-17 08:08:00 +02:00
Philipp Krones
19183a6af5
Rollup merge of #5468 - Toxyxer:zero-single-char-names, r=flip1995
...
Zero single char names
Fixes : #4086
changelog:
- Make the inequality strict
2020-04-15 20:12:31 +02:00
Philipp Krones
ceea3c6a35
Rollup merge of #5248 - ThibsG:ConstValues, r=flip1995
...
Add lint on large non scalar const
This PR adds the new lint `non_scalar_const` that aims to warn against `const` declaration of large arrays. For performance, because of inlining, large arrays should be preferably declared as `static`.
Note: i made this one to warn on all const arrays, whether they are in a body function or not. I don't know if this is really necessary, i could just reduce this lint to variables out of function scope.
Fixes : #400
changelog: add new lint for large non-scalar types declared as const
2020-04-15 20:12:28 +02:00
Philipp Krones
a353f0f174
Rename dummy_hir_id -> parent_hir_id
2020-04-15 19:46:05 +02:00
Matthias Krüger
721549569c
rustup https://github.com/rust-lang/rust/pull/71116
2020-04-15 18:58:44 +02:00
Marcin Serwin
ce372c17cd
Change default many single char names threshold
2020-04-15 17:58:26 +02:00
bors
c6cc07a851
Auto merge of #5452 - phansch:match_def_path_refactor, r=matthiaskrgr
...
Refactor: Use rustc's `match_def_path`
This replaces our match_def_path implementation with the rustc one.
Note that we can't just use it in all call sites because of the
`&[&str]` / `&[Symbol]` difference in Clippy/rustc.
changelog: none
2020-04-15 05:42:52 +00:00
Philipp Hansch
9ec95af702
Refactor: Use rustc's match_def_path
...
This replaces our match_def_path implementation with the rustc one.
Note that we can't just use it in all call sites because of the
`&[&str]` / `&[Symbol]` difference in Clippy/rustc.
2020-04-15 07:23:13 +02:00
bors
81b3e7096b
Auto merge of #5449 - phansch:diagnostic-items, r=matthiaskrgr
...
Make use of more diagnostic items
This makes use of some (not all) already existing diagnostic items. Specifically:
* 79982a2
: `core::mem::uninitialized`, `core::mem::zeroed`, `alloc::sync::Arc`, `alloc::sync::Rc`
* 83874d0
: `Option` and `Result`
cc #5393
changelog: none
2020-04-14 19:58:17 +00:00
Philipp Hansch
e47db677ac
Cleanup: Use rustc's is_proc_macro_attr
...
It's doing exactly the same: https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_ast/expand/mod.rs.html#8-12
2020-04-13 09:33:00 +02:00
Philipp Hansch
79982a2813
Make use of some existing diagnostic items
2020-04-12 13:58:04 +02:00
Philipp Hansch
1d1b6d886b
Say that diagnostic items are preferred over paths
2020-04-12 13:58:04 +02:00
Matthias Krüger
f7bdead5ec
rustup https://github.com/rust-lang/rust/pull/69745
2020-04-11 01:51:25 +02:00
ThibsG
629cc4ada3
Update doc generation script
2020-04-09 09:17:41 +02:00
Linus Färnstrand
51bb1d28c5
Use assoc const NAN for zero_div_zero lint
2020-04-08 00:43:27 +02:00
flip1995
98aa5938c4
Rustup to rust-lang/rust#70634
2020-04-02 22:29:41 +02:00
Jacek Pospychala
f8e892db5e
useless Rc<Rc<T>>, Rc<Box<T>>, Rc<&T>, Box<&T>
2020-04-02 00:02:25 +02:00
flip1995
7d58ba20b4
Rustup to rust-lang/rust#70632
2020-04-01 20:14:05 +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
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
8177e49e10
rustup https://github.com/rust-lang/rust/pull/70344
2020-03-27 20:41:35 +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
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
Tim Robinson
870b9e8139
nursery group -> style
2020-03-23 16:45:31 +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
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
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
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
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
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
Jacob Meyers
0f7f30711e
add lint on File::read_to_string and File::read_to_end
2020-03-06 09:50:49 -05:00
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
Yuki Okushi
9086b17e14
Rustup to rust-lang/rust#67707
2019-12-31 09:17:56 +09:00
Yuki Okushi
a4c201e6b4
Rustup to rust-lang/rust#66942
2019-12-30 13:02:10 +09:00
Yuki Okushi
e2636729ec
Rustup to rust-lang/rust#66936
2019-12-27 16:13:53 +09: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
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
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
9632e27487
Add <'_> where necessary
2019-12-22 15:42:41 +01:00
Lzu Tao
d1ca5f1d7c
rustup "Merge ast::Mutability
and mir::Mutability
"
2019-12-21 18:38:45 +00:00
Matthias Krüger
98e433d70d
Rustup to rust-lang/rust#66878
2019-12-04 01:34:01 +01:00
Philipp Hansch
c1ccba005f
fmt
2019-11-29 20:47:50 +01:00
Philipp Hansch
ad6d8a4700
Make triggering this lint less likely 📎
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
flip1995
b2523afae4
Use infer_ctxt
2019-11-29 11:12:19 +01:00
Manish Goregaokar
45842e5131
Fix categorizations
2019-11-28 07:33:12 -08:00
Manish Goregaokar
c1c5c3522d
Fix arguments on ExprUseVisitor::new
2019-11-28 07:20:37 -08:00
Manish Goregaokar
dc9d839410
euv moved from middle to typeck
2019-11-28 07:17:56 -08:00
Manish Goregaokar
85bb66480c
cmt_ -> Place
2019-11-28 07:09:02 -08:00
Manish Goregaokar
e381143a6b
More borrowkind fixes
2019-11-27 15:09:48 -08:00
Manish Goregaokar
3430bc1bc5
Re-add wildcards for BorrowKind in some places
2019-11-27 15:09:48 -08:00
Manish Goregaokar
341e266508
Add BorrowKind::Ref
2019-11-27 14:39:28 -08:00
flip1995
6eeac46b91
Run rustfmt
2019-11-25 15:20:10 +01:00
flip1995
d43c424145
Rustup to rust-lang/rust#66671
2019-11-25 13:18:38 +01:00
bors
cc35165f52
Auto merge of #4840 - flip1995:rollup-jqk3a3i, r=flip1995
...
Rollup of 5 pull requests
Successful merges:
- #4730 (Fix check_infinite_loop (while_immutable_condition) by checking for break or return inside loop body)
- #4766 (Fix false positive in derive_hash_xor_eq)
- #4811 (Literal Representation Restructure)
- #4820 (doc: fix the comment above the lint function)
- #4830 (use more efficient code to generate repeated string)
Failed merges:
r? @ghost
changelog: none
2019-11-23 17:40:57 +00:00
Philipp Krones
623d8c4640
Rollup merge of #4811 - mikerite:lit_repr_20191113, r=flip1995
...
Literal Representation Restructure
This pull request restructures the literal_representation module to be easier to understand and maintain. I split the changes into a lot of commits to make reviewing easier.
changelog: none
2019-11-23 18:16:00 +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
e4636f3c39
Rustup to rust-lang/rust#66515
...
Fixes #4835
2019-11-22 13:47:33 +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
Michael Wright
2e9d173be1
literal representation restructure 12
...
Export function for formatting literals and remove crate visibility from
other items.
2019-11-13 08:28:50 +02:00
Manish Goregaokar
e9a3e54910
MutImmutable -> Immutable, MutMutable -> Mutable, CaptureClause -> CaptureBy
2019-11-11 10:58:39 -08:00
HMPerson1
94b36d9ca4
dogfood
2019-11-08 15:41:54 -05:00
HMPerson1
d4758420e6
Rustup rust-lang/rust#66188
2019-11-08 15:12:08 -05:00
Lzu Tao
acbe224f6a
rustup https://github.com/rust-lang/rust/pull/65916
2019-11-08 10:23:42 +07:00
Heinz N. Gies
695aa59c6d
Add lint for exit
2019-11-07 17:10:18 +01:00
flip1995
e917b01286
Rustup to rust-lang/rust#65884
2019-11-07 13:27:00 +01:00
Manish Goregaokar
305ba73fc1
Rustup to rustc 1.40.0-nightly (7a76fe76f 2019-11-07)
2019-11-07 13:14:40 +01:00
bors
0be213bb79
Auto merge of #4772 - HMPerson1:tastier_ice_cream, r=flip1995
...
Use correct TypeckTables when hashing bodies
Fixes #4760
changelog: Fix ICE while hashing block expressions #4760
r? @phansch
2019-11-06 15:50:42 +00:00
Lzu Tao
51632530d7
rustup rust-lang/rust#65776
2019-11-06 17:46:45 +07:00
Lzu Tao
98313bd83a
chore: remove unnecessary parentheses around type
2019-11-05 22:05:55 +07:00
HMPerson1
e3d6069e18
Use correct TypeckTables when hashing bodies
2019-11-04 20:03:03 -05:00
Matthias Krüger
ece5f862c4
rustup https://github.com/rust-lang/rust/pull/65792/
2019-10-28 15:15:28 +01:00
flip1995
562cc63b7e
Fix lint_without_lint_pass lint
2019-10-24 13:54:18 +02:00
flip1995
237e168b89
Fix tests
2019-10-24 13:29:51 +02:00
flip1995
5f4b5b91d7
Rustup to rust-lang/rust#65657
2019-10-24 11:54:11 +02:00
bors
087e5eaea5
Auto merge of #4691 - HMPerson1:suggest_iter, r=phansch
...
Fix suggestion of `explicit_counter_loop`
changelog: In the suggestion of `explicit_counter_loop`, if the `for` loop argument doesn't implement `Iterator`, then we suggest `x.into_iter().enumerate()` (or `x.iter{_mut}()` as appropriate). Also, the span of the suggestion has been corrected.
Fixes #4678
2019-10-23 20:12:14 +00:00
flip1995
e8d5a9e95c
Use StableHasher in SpanlessHasher
2019-10-22 14:57:44 +02:00
flip1995
ef18ece564
Don't hash spans in SpanlessHasher
2019-10-22 11:17:16 +02:00
HMPerson1
a9cb2b9001
Fix suggestion for ranges
2019-10-18 12:11:15 -04:00
Andre Bogus
d723b35aee
Omit proc macros from must_use_candidate
2019-10-18 15:54:25 +02:00
bors
14a0f36617
Auto merge of #4683 - HMPerson1:inefficient_to_string, r=Manishearth
...
Add `inefficient_to_string` lint
Closes #4586
changelog: Add `inefficient_to_string` lint, which checks for calling `to_string` on `&&str`, which would bypass the `str`'s specialization
2019-10-17 23:48:55 +00:00
Manish Goregaokar
fcad3cb9ea
syntax::ext -> syntax_expand
2019-10-17 15:57:48 -07:00
HMPerson1
106a72592c
Dogfood for inefficient_to_string
2019-10-16 17:12:41 -04: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
Matthias Seiffert
15b433af48
Use match_function_call wherever possible
2019-10-10 20:06:04 +02:00
Matthias Seiffert
37a2de1562
Move match_function_call to utils
2019-10-10 10:57:12 +02:00
flip1995
3aa531c194
Run util/dev fmt
2019-10-05 12:42:09 +02:00
flip1995
3b23092b69
Get rid of rvalue_promotable_map method call
2019-10-05 12:38:38 +02:00
flip1995
b46f5b4a98
Rustup to rust-lang/rust#64874
...
Episode 1 - The simple cases
2019-10-04 15:39:46 +02:00
Lzu Tao
6b1a8683f4
Add suggestion for zero-ptr lint
2019-10-02 22:38:00 +07:00
Lzu Tao
6e3a0ea6b3
Rustup rust-lang/rust#63492
2019-09-29 22:58:17 +07:00
Matthias Krüger
5f6e3f35b5
rustup https://github.com/rust-lang/rust/pull/64781/
...
cc https://github.com/rust-lang/rust/issues/64867
2019-09-28 10:42:41 +02:00
flip1995
8d8ba14371
Fix author lint
2019-09-27 18:01:04 +02:00
flip1995
4bbd10a585
Rustup to rust-lang/rust#64813
2019-09-27 17:21:20 +02:00
Matthias Krüger
e59d619981
rustup https://github.com/rust-lang/rust/pull/64515
...
changelog: none
2019-09-26 18:34:43 +02:00
Lzu Tao
a7b7e19f49
Rustup https://github.com/rust-lang/rust/pull/64513
2019-09-26 16:03:36 +07:00
bors
4d30b08027
Auto merge of #4569 - james9909:add-comparison-chain, r=oli-obk
...
Add a new lint for comparison chains
changelog: Adds a new lint: `comparison_chain`.
`comparison_chain` lints all `if` conditional chains where all the conditions are binary comparisons on the same two operands and will suggest a rewrite with `match`.
Closes #4531 .
2019-09-26 07:38:08 +00:00
Manish Goregaokar
982c51e769
arm.pats -> arm.pat
2019-09-25 12:52:16 -07: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
Michael Wright
16ce071bed
Work around qpath_res issue
2019-09-18 21:57:14 +02:00
Michael Wright
00ca42fe5b
Fix lint warnings
2019-09-12 08:36:05 +02:00
Matthias Krüger
b72982759c
run rustfmt
2019-09-11 08:26:57 +02:00
Andre Bogus
5823e9468d
New is_integer_const
to check more const ints
...
This mostly affects loop checks and the modulo_one lint. Tests
were also updated where applicable.
2019-09-10 17:46:39 +02:00
Andre Bogus
e3c4ffd4aa
Use diagnostic item for
2019-09-09 05:43:39 +02:00
bors
f30bf69ec7
Auto merge of #4508 - rust-lang:reduced-symbolism, r=phansch
...
Simplify `utils::match_def_path`, removing a FIXME
changelog: none
This removes the `Vec<Symbol>` allocation. We still need to call `cx.get_def_path`, but this should already have been interned, and I don't see how we can keep ergonomics of that function without allocating a `Vec`.
r? @phansch
2019-09-06 15:10:06 +00:00
Andre Bogus
72058a6d0d
Simplify , removing a FIXME
2019-09-06 09:40:36 +02:00
Jeremy Stucki
3fc1ec1ffd
Refactor option handling
2019-09-04 16:19:59 +02:00
bors
a2c4b2b8da
Auto merge of #4490 - mikerite:fix-4364, r=flip1995
...
Fix `too_many_lines` false positive
changelog: Fix `too_many_lines` false positive
2019-09-04 11:35:13 +00:00
bors
8239b7616f
Auto merge of #4454 - BO41:search_is_some, r=flip1995
...
Dereference one less on search_is_some and make it auto-fixable
Fixes #4453
changelog: none
2019-09-04 07:53:44 +00:00
BO41
64cd9e4d60
Try to fix .fixed
2019-09-03 18:56:23 +02:00
bors
11da8c18a2
Auto merge of #4479 - rust-lang:uninit_assume_init, r=flip1995
...
lint against `MaybeUninit::uninit().assume_init()`
changelog: add `uninit_assumed_init` lint
This fixes #4272
2019-09-03 16:14:40 +00:00
Andre Bogus
b01f2d1126
lint against MaybeUninit::uninit().assume_init()
2019-09-03 17:37:38 +02:00
Michael Wright
232dd43fe9
Fix occurrences of too_many_lines
violations
2019-09-03 06:26:49 +02:00
Philipp Hansch
fb1ae1747f
Fix cast_lossless false positive in impl const fn
...
Fixes https://github.com/rust-lang/rust-clippy/issues/3656#issuecomment-526387382
2019-08-30 07:22:35 +02:00
flip1995
dac81d867b
Use the spans returned by utils::method_calls
2019-08-29 17:34:03 +02:00
flip1995
832c0830ec
Also return the method spans in utils::method_calls
2019-08-29 17:34:02 +02:00
Yuki Okushi
2c282252a9
Replace Arg
with Param
2019-08-28 18:33:25 +09:00
Lzu Tao
dac2509bac
Account for trait alias when looking for defid
2019-08-25 20:36:11 +07:00
Philipp Hansch
818b2ccfc5
Rustup to https://github.com/rust-lang/rust/pull/63854
2019-08-25 08:06:32 +02:00
Lzu Tao
5b367ed4a3
Add missing field to LitKind::Str
2019-08-23 18:02:13 +07:00
Lzu Tao
09d302a786
Re-factor useless_format lint
2019-08-23 09:16:50 +00:00
Michael Wright
59893bcab0
Fix temporary_cstring_as_ptr
false negative
...
Fixes #4375 .
Changes the check to test when `.unwrap().as_ptr()` is called on any
`Result<CString, _>` as suggested by @flip1995
(https://github.com/rust-lang/rust-clippy/issues/4375#issuecomment-520724123 ).
2019-08-21 07:35:04 +02:00
KRAAI, MATTHEW [VISUS]
204b2f3658
Remove in_macro_or_desugar
2019-08-19 09:30:32 -07:00
Michael Wright
b313d25350
Fix breakage due to rust-lang/rust#61708
2019-08-18 13:14:47 +02:00
flip1995
2456b355f2
Run rustfmt
2019-08-16 19:05:44 +02:00
KRAAI, MATTHEW [VISUS]
f74d9db7f4
Use outer_expn_data instead of outer_expn_info
2019-08-16 09:31:12 -07:00
Lzu Tao
65b906a8fc
Rustup "Remove Spanned
from {ast,hir}::FieldPat
"
2019-08-16 09:32:27 +07:00
flip1995
9533fa5b19
Rustup to rust-lang/rust#63543
2019-08-15 10:14:06 +02:00
Jeremy Stucki
f0ce04f814
Handle calls with 'std::convert::identity'
2019-08-11 19:51:43 +02:00
Ralf Jung
2dcce60fdc
deprecate invalid_ref lint
2019-08-11 09:31:55 +02:00
Philipp Hansch
71a943820b
Rustup to https://github.com/rust-lang/rust/pull/63213
2019-08-05 07:30:01 +02:00
bors
3dc91838e4
Auto merge of #4325 - phansch:doctests_complexity, r=flip1995
...
Doctests: Enable running doc tests for complexity lints
changelog: none
master: `113 passed; 0 failed; 91 ignored; 0 measured; 0 filtered out`
this PR: `181 passed; 0 failed; 110 ignored; 0 measured; 0 filtered out`
cc #4319
2019-08-03 13:24:07 +00:00
Philipp Hansch
d61df4f609
Rustup to latest rustc master
...
Broken due to:
* https://github.com/rust-lang/rust/pull/63180 (`Existential` -> `OpaqueTy`)
* https://github.com/rust-lang/rust/pull/63121 (New fields for `FormatSpec`)
2019-08-03 08:44:32 +02:00
Philipp Hansch
abfa8a952c
Doctests: Fix all complexity lint docs
...
cc #4319
2019-08-02 18:16:35 +02:00
Jakub Wieczorek
2a13e83f2b
Update all the code to pass the updated use_self
lint.
...
One struct required a temporary `#[allow(dead_code)]` annotation due to
a bug in the Rust compiler: https://github.com/rust-lang/rust/issues/63151 .
2019-07-31 08:50:43 +00:00
xd009642
78ebcaa526
Fix dogfood test
2019-07-28 09:31:05 +01:00
xd009642
03c543515a
Hash discriminant of lifetime.name
2019-07-27 23:04:36 +01:00
xd009642
ad637193f0
Hash discriminant of Lifetime::Name
2019-07-27 22:59:46 +01: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
xd009642
cac69ec063
Respond to comments and improve printout
...
Now get the trait names for the diagnostic message and removed more
`let c: fn(_) -> _ = T; hashes from hir_utils
2019-07-27 11:51:27 +01:00
xd009642
7853dac662
Responded to comments and fixed compile bug
...
Removed the hash of `let c: fn(_,_) -> _ = ExprKind::Cast` and
fixed compile issue by collecting HirVec into an actual Vec
2019-07-26 16:46:47 +01:00
xd009642
c0259179c3
Fixed more compile errors
...
Moved to rustc::hir::Ty
2019-07-24 22:59:32 +01:00
xd009642
792153104c
Fix some of the compile errors
2019-07-24 22:27:12 +01:00
xd009642
f3e4467c10
Changed Ty to ty, added lifetime 'tcx
2019-07-24 21:14:21 +01:00
xd009642
f71d59e6a6
Lint for type repetition in trait bounds.
...
This lint adds warning if types are redundantly repeated in trait bounds i.e. `T: Copy, T: Clone` instead of `T: Copy + Clone`. This is a late pass trait lint and has necessitated the addition of code to allow hashing of TyKinds without taking into account Span information.
2019-07-24 21:14:21 +01:00
Michael Wright
67db88f645
Fix breakage due to rust-lang/rust#62705
...
Also rename `OUTER_EXPN_INFO` to `OUTER_EXPN_EXPN_INFO` to match new
function names.
2019-07-21 09:36:31 +02:00
Lzu Tao
27c5348793
Rustup macro expansion and resolution
2019-07-12 00:26:36 +07:00
Michael Wright
adcc02ed8a
Address reviews
2019-07-06 19:35:08 +02:00
Michael Wright
0579c3e0aa
Fix breakage due to rust-lang/rust#61988
2019-07-06 19:06:49 +02:00
Lzu Tao
7293defb34
Rename hir::map::local_def_id_from_hir_id to local_def_id
2019-07-06 10:52:51 +07:00
Matthias Krüger
f18f81d6a6
rustup https://github.com/rust-lang/rust/pull/61995
2019-07-03 18:00:35 +02:00
bors
ad638a3e42
Auto merge of #4222 - jfrikker:try_err, r=flip1995
...
Adding try_err lint
changelog: Adds the "try_err" lint, which catches instances of the following: Err(x)?
fixes #4212
2019-07-01 07:41:33 +00:00
Manish Goregaokar
d744dcdaaf
find_by_hir_id -> find
2019-06-25 14:34:07 -07:00
Manish Goregaokar
c47a7e4ef2
get_parent_node_by_hir_id -> get_parent_node
2019-06-25 14:33:51 -07:00
Mazdak Farrokhzad
4434bfac01
Fix dogfood test failures.
2019-06-24 04:00:05 +02:00
Joe Frikker
1e6c6976dd
PR comments
2019-06-23 18:02:13 -04:00
Mazdak Farrokhzad
b918594369
Fix fallout from rust-lang/rust PR 60861.
2019-06-23 17:24:45 +02:00
Lzu Tao
6aea41e050
Fix fallout cause NodeId pruning
2019-06-22 13:41:16 +07:00
Jeremy Stucki
746fbad98a
Remove needless lifetimes
2019-06-21 14:41:19 +02:00
flip1995
ca2ba973a7
Remove unnecssary lifetime from trait_ref_of_method
2019-06-21 12:32:39 +02:00
Michael Wright
837b5208f7
Fix breakage due to rust-lang/rust#61968
2019-06-21 08:14:07 +02:00
Lzu Tao
4fa498a3eb
Fix warnings about unnecessary lifetime bounds
...
Rustup https://github.com/rust-lang/rust/pull/61172
2019-06-20 01:36:23 +07:00
Lzu Tao
321779979a
Fix missing field in ExprKind::Yield
...
Rustup rust-lang/rust#61941
2019-06-19 16:59:25 +07:00
Matthias Krüger
4d984dc6e6
rustup https://github.com/rust-lang/rust/pull/61836/
2019-06-18 11:15:47 +02:00
Lzu Tao
9bfdbd13c2
Fix wrong lifetime of TyCtxt
2019-06-14 23:47:48 +07:00
Lzu Tao
3832a8d253
Fix wrong lifetime of TyCtxt
2019-06-13 02:49:02 +07:00
Lzu Tao
79e3c7cd55
Remove wrong lifetime from LintContext
2019-06-12 10:28:52 +02:00
Matthias Krüger
7d83e13660
rustup https://github.com/rust-lang/rust/pull/61669/
2019-06-09 15:21:28 +02:00
Michael Wright
b726b41daf
Add OUTER_EXPN_INFO lint
2019-06-08 13:35:04 +02:00
bors
71be6f62fa
Auto merge of #4177 - mikerite:compiler_lint_functions_fewer_strings, r=phansch
...
Remove `to_string()`s from CompilerLintFunctions
changelog: none
2019-06-06 10:25:13 +00:00
Matthias Krüger
d0ca09883e
rustup https://github.com/rust-lang/rust/pull/57428/
2019-06-06 09:21:19 +02:00
Michael Wright
b36d7a0c61
Remove to_string()
s from CompilerLintFunctions
2019-06-06 07:12:12 +02:00
Mateusz Mikuła
a3ace5c3ca
Cargo fmt
2019-06-02 18:58:11 +02:00
Mateusz Mikuła
9fefe36737
Rustup for https://github.com/rust-lang/rust/pull/61276
2019-06-02 18:30:40 +02:00
Lzu Tao
f67c3e4b2a
Make use of new outer_expn_info()
function
2019-06-01 16:25:51 +07:00
Oliver Scherer
f98e4bd33b
Fix Block
dump in author lint
2019-05-28 13:01:11 +02:00
Oliver Scherer
73d1830812
Rustup to rustc 1.36.0-nightly (fa40a111f 2019-05-27)
2019-05-27 21:58:54 +02:00
Matthias Krüger
c67d2b121a
rustup https://github.com/rust-lang/rust/pull/60803/
2019-05-24 15:25:36 +02:00
Philipp Hansch
aca56727db
Rustup to https://github.com/rust-lang/rust/pull/59545
2019-05-24 08:19:51 +02:00
Philipp Hansch
635a2fa5df
Rustup to https://github.com/rust-lang/rust/pull/60740
...
changelog: none
2019-05-23 07:19:25 +02:00
Manish Goregaokar
a6cf35264f
Rustup to rustc 1.36.0-nightly (dbfe70dfc 2019-05-22)
2019-05-21 21:58:27 -07:00
Oliver Scherer
f49ef0ec04
Dogfood
2019-05-18 01:42:15 +02:00
Oliver Scherer
462df72100
Dogfood and rustfmt
2019-05-18 00:58:25 +02:00
Oliver Scherer
f7f85a0dca
Prevent symbocalypse
2019-05-17 23:53:54 +02:00
flip1995
5dea5d404c
Fix dogfood errors
2019-05-14 15:08:29 +02:00
flip1995
4b4d734758
Also hash mem::discriminant in hash_stmt
2019-05-14 14:13:23 +02:00
Oliver Scherer
f11b236087
mem::discriminant trumps manual discriminant hashing
2019-05-14 14:04:55 +02:00
Oliver Scherer
bc031d4c74
Properly hash enums
2019-05-14 13:57:48 +02:00
Oliver Scherer
dfbc74b08b
Rustfmt all the things
2019-05-14 10:33:48 +02:00
Oliver Scherer
af80c53450
Clippy dogfood
2019-05-14 10:33:48 +02:00
Oliver Scherer
b2dbda4d48
Use symbols instead of strings
2019-05-14 10:33:42 +02:00
Manish Goregaokar
abf6481f87
Add in_macro again
2019-05-11 21:39:37 -07:00
Manish Goregaokar
7eb8018554
Rename in_macro to in_macro_or_desugar
2019-05-11 21:39:02 -07:00
Manish Goregaokar
19cfb84405
Start handling desugarings in author lint
2019-05-10 23:43:58 -07:00
Manish Goregaokar
0499184201
Ignore desugarings in macro checks
2019-05-10 23:40:42 -07:00
Manish Goregaokar
5661e5947f
Add IfDesugar to desugaring_name
2019-05-10 23:40:42 -07:00
Manish Goregaokar
69b1da4d82
Remove some unnecessary If arms
2019-05-10 23:40:42 -07:00
Manish Goregaokar
e7af60f258
Add util function for desugaring if block
2019-05-10 23:40:42 -07:00
Andy Russell
9ede56f383
use derive
feature over serde_derive
crate
2019-05-09 13:05:34 -04:00
Matthias Krüger
857c2c53bf
rustup https://github.com/rust-lang/rust/pull/60586
...
cc https://github.com/rust-lang/rust/issues/60623
2019-05-08 06:58:37 +02:00
Matthias Krüger
d618637c05
Rustup to rustc 1.36.0-nightly (13fde05b1 2019-05-03)
2019-05-03 22:28:34 -07:00
Matthias Krüger
f195680edb
more Use->DropTemps fixes
2019-05-01 23:04:35 +02:00
Matthias Krüger
24e856f10a
rustup https://github.com/rust-lang/rust/pull/60417/
...
cc https://github.com/rust-lang/rust/issues/60448
2019-05-01 22:18:16 +02:00
André Luis Leal Cardoso Junior
e428862c95
Update find(p).map(p) occurrences to use find_map(p)
2019-04-30 16:45:32 -03:00
Michael Wright
5ad79c2b3d
Fix breakage due to rust-lang/rust#60225
2019-04-28 09:11:20 +02:00
Philipp Hansch
1f5a3c6e52
Rustup for https://github.com/rust-lang/rust/pull/59042
2019-04-25 07:29:23 +02:00
Manish Goregaokar
7e2043de2f
Ignore all enum and struct constructors in lints about *or(call())
2019-04-23 08:01:42 -07:00
Philipp Hansch
850c24edd3
Fix false positive in module_name_repetitions lint
...
This lint was triggering on modules inside expanded attrs, like
for example `#[cfg(test)]` and possibly more.
2019-04-19 12:53:03 +02:00
Matthew Kraai
753c39672e
Use lint pass macros
...
Fixes #3917 .
2019-04-17 09:35:22 -07:00
flip1995
ce87051779
Fix lint_without_lint_pass internal lint
2019-04-17 06:51:21 -07:00
flip1995
840eac2c05
Use {get,match}_def_path from LateContext
2019-04-17 12:53:29 +02:00
flip1995
2f100e04af
Remove uplifted functions {get,match}_def_path from Clippy
2019-04-17 12:51:57 +02:00
flip1995
5361b842d1
Remove clippy::default_hash_types internal lint
2019-04-15 13:21:52 +02:00
Manish Goregaokar
2156f6733e
Clean up unused cx parameters
2019-04-14 13:23:43 -07:00
Manish Goregaokar
1b2f2be085
Remove now-unnecessary calls to node_to_hir_id
2019-04-14 13:11:31 -07:00
flip1995
3fe5eea4e4
Fix get_def_path
...
This fix is obsolet once rust-lang/rust#59779 and #3926 is merged.
2019-04-12 11:59:06 +02:00
Tomas Koutsky
603996c9d5
Support updated type dependent def ID getter
2019-04-10 16:18:02 +02:00
Andy Russell
0d50d44ea6
use a multispan for MANY_SINGLE_CHAR_NAMES
2019-04-05 10:07:39 -04:00
flip1995
bbb7963735
Fix dogfood error of question_mark lint fix
2019-04-01 20:37:05 +02:00
flip1995
6f01ecfefd
Fix question_mark lint+test
2019-04-01 20:37:05 +02:00
Oliver Scherer
d020565ed2
Hacky rustup
2019-03-26 10:55:03 +01:00
Mateusz Mikuła
6cb0605600
Cargo fmt
2019-03-18 13:39:11 +01:00
Mateusz Mikuła
0ea5e38a9e
name -> check_name
2019-03-18 12:54:10 +01:00
Mateusz Mikuła
e63a685412
NestedMetaItemKind -> NestedMetaItem
2019-03-18 12:54:10 +01:00
Mateusz Mikuła
cb3aa7480c
Fix path_qualified
...
As suggested by eddyb
2019-03-18 12:54:10 +01:00
Mateusz Mikuła
9b7ff501a6
Replace most of ty:Ty with Ty
2019-03-18 12:54:10 +01:00
flip1995
4832a853c7
Feed dog
2019-03-16 15:39:02 +01:00
flip1995
180e07e99e
Adapt paths to new formatting
2019-03-16 15:22:31 +01:00
flip1995
3c4616d303
cargo fmt
2019-03-16 11:51:57 +01:00
flip1995
254fad95de
Use LocalInternedString inside of AbsolutePathPrinter
2019-03-16 11:45:29 +01:00
flip1995
dae5c9c685
AbsolutePathBuffer -> AbsolutePathPrinter
2019-03-16 11:17:36 +01:00
flip1995
31435cd7f5
Reimplement AbsolutePathBuffer
2019-03-15 23:42:46 +01:00
Philipp Hansch
8a59f81180
Rename span_lint_node* functions to span_lint_hir*
...
Because they now take a `hir_id` instead of a `node_id` argument.
2019-03-12 08:01:21 +01:00
Alexander Regueiro
d2b85323ad
Addressed points raised in review.
2019-03-10 18:06:28 +00:00
Alexander Regueiro
d43966a176
Various cosmetic improvements.
2019-03-10 18:06:28 +00:00
bors
ccfbfb8097
Auto merge of #3860 - phansch:refactor_out_opt_def_id, r=flip1995
...
Refactor: Remove utils::opt_def_id
This removes some indirection. Probably this method was uplifted to
rustc at some point?
2019-03-09 12:05:41 +00:00
Philipp Krones
c32135a87f
Rollup merge of #3857 - phansch:document_path_qpath, r=flip1995
...
Document match_path, improve match_qpath docs
Inching towards enabling `#[deny(missing_docs)]` in utils 📜
2019-03-09 12:24:44 +01:00
Philipp Krones
1902384d15
Rollup merge of #3851 - phansch:refactor_trait_stuff, r=flip1995
...
Refactor: Extract `trait_ref_of_method` function
This pattern was used in three places after #3844 , so I think it's worth moving it into `utils/mod.rs` and documenting it.
2019-03-09 12:24:42 +01:00
Philipp Hansch
9d97ed6faa
Refactor: Remove utils::opt_def_id
...
This removes some indirection. Probably this method was uplifted to
rustc at some point?
2019-03-08 14:14:41 +01:00
Philipp Hansch
f04acdd463
Document match_path, improve match_qpath docs
2019-03-08 09:50:20 +01:00
Philipp Krones
837d675afd
Update clippy_lints/src/utils/mod.rs
...
Co-Authored-By: phansch <dev@phansch.net>
2019-03-08 09:40:12 +01:00
Philipp Hansch
65694cc6c8
Fix doctest
2019-03-08 09:10:41 +01:00
ljedrz
5d78250c75
align with rust-lang/rust/#58992
2019-03-07 21:51:05 +01:00
rchaser53
ae787d954e
fix missing a semicolon
2019-03-07 23:26:47 +09:00
Philipp Hansch
e1d47cd5f1
Refactor: Extract trait_ref_of_method
function
2019-03-07 08:17:43 +01:00
Félix Fischer
ddc718087f
Renamed: Cyclomatic Complexity -> Cognitive Complexity
...
* Ran automatic naming update
* Formalized rename of `cyclomatic_complexity` to `cognitive_complexity`
** Added the rename to `lib.rs`
** Added rename test
* Added warning for deprecated key `cyclomatic_complexity_threshold` and tests for it
* Added deprecation status for Clippy's builtin attribute
* Updated tests for new builtin attribute renaming
2019-03-06 10:07:38 -03:00
Andy Russell
fe96ffeac9
move lint documentation into macro invocations
2019-03-05 18:45:08 -05:00
ljedrz
f3363b9cf2
align with rust-lang/rust/#58836
2019-03-01 19:10:14 +01:00
ljedrz
f2587703cc
enable rust-lang/rust#58754
2019-03-01 19:10:14 +01:00
flip1995
1463d6f69f
Error an unknown or deprecated Clippy attribute
2019-02-28 16:44:42 +01:00
bors
412d41ae86
Auto merge of #3814 - ljedrz:HirIdification_lockstep_upgrade, r=phansch
...
HirIdify some lints
Unblocks https://github.com/rust-lang/rust/pull/58561 (a part of [rust-lang/rust#57578 ](https://github.com/rust-lang/rust/pull/57578 )). Can we branch it like with https://github.com/rust-lang/rust-clippy/pull/3790 ? I can rebase on a different commit if need be.
Haven't had time to run tests yet, so I'd wait for Travis 🙈 .
2019-02-26 10:43:50 +00:00
bors
1ac6f4e9ae
Auto merge of #3772 - flip1995:ice-3719, r=Manishearth
...
Fix ICE #3719+#3718 in lint match_ref_pats
Fixes #3719
This conveniently also fixes #3718
The ICE occurs when the match expression was a macro call, where the macro was defined in another file. Since we don't have the ability to reproduce this behavior with our UI tests (AFAIK), I couldn't add a test reproducing this ICE.. However, I added a test which is related to the ICE, to show the new behavior of the lint.
I tested it with the mscheme repo locally and the ICE didn't happen anymore.
r? @matthiaskrgr
2019-02-25 12:30:35 +00:00
ljedrz
7bc2e1d60d
fix: replace wrong id
2019-02-25 11:06:46 +01:00
Philipp Hansch
bd949328f1
Make DiagnosticWrapper private
...
It's doesn't have to be public anywhere outside of clippy_lints
2019-02-25 07:19:56 +01:00
ljedrz
8dac8a6ba4
HirIdify some lints
2019-02-24 20:49:43 +01:00
bors
5833e4d26e
Auto merge of #3810 - phansch:refactor/extract_module, r=flip1995
...
Extract diagnostics module and document some functions
This moves the lint building functions from `utils/mod.rs` to their own
`utils/diagnostics.rs` file. Also adds documentation for three of them.
2019-02-24 15:35:01 +00:00
bors
1ce961f083
Auto merge of #3790 - ljedrz:HirIdify_intravisit, r=phansch
...
partially HirIdify lints
Enables https://github.com/rust-lang/rust/pull/58232 (a part of https://github.com/rust-lang/rust/pull/57578 ).
2019-02-24 14:32:55 +00:00
Philipp Hansch
7d883cddbc
Extract diagnostics module and document some functions
...
This moves the lint building functions from `utils/mod.rs` to their own
`utils/diagnostics.rs` file. Also adds documentation for three of them.
2019-02-24 14:11:05 +01:00
Philipp Hansch
ff1b1a7c9f
Document some span_lint_*
util functions
2019-02-24 09:49:17 +01:00
bzzzz
7767b3a081
Fixed formatting and typo
2019-02-20 10:12:24 -08:00
ljedrz
1fac380886
partially HirIdify lints
2019-02-20 13:16:16 +01:00
bzzzz
f9c6682827
Make needless_range_loop not applicable to structures without iter method
2019-02-20 00:10:25 -08:00
flip1995
75f39881d4
Document the new Sugg
functions
2019-02-19 21:34:14 +01:00
flip1995
1a86d80c10
Implement Sugg::hir_with_macro_callsite
2019-02-19 21:34:14 +01:00
Michael Howell
2df14c3701
Add a lint to warn on T: Drop
bounds
...
**What it does:** Checks for generics with `std::ops::Drop` as bounds.
**Why is this bad?** `Drop` bounds do not really accomplish anything.
A type may have compiler-generated drop glue without implementing the
`Drop` trait itself. The `Drop` trait also only has one method,
`Drop::drop`, and that function is by fiat not callable in user code.
So there is really no use case for using `Drop` in trait bounds.
**Known problems:** None.
**Example:**
```rust
fn foo<T: Drop>() {}
```
2019-02-17 22:53:08 -07:00
flip1995
10811d5d89
Fix breakage from rust-lang/rust#58296
2019-02-14 14:01:43 +01:00
flip1995
5a3cd31c9e
Rustup
...
cc rust-lang/rust#58137
2019-02-13 22:08:17 +01:00
Grzegorz
16881390e1
removing redundant closures in the whole project
2019-02-10 13:35:44 +01:00
bors
5725726345
Auto merge of #3751 - h-michael:opt-def-id, r=phansch
...
Use Hir::Def opt_def_id
related with: https://github.com/rust-lang/rust-clippy/pull/3750#issuecomment-462010225
Using `def.opt_def_id` in `opt_def_id` before replacing all all at once.
2019-02-09 12:01:45 +00:00
Hirokazu Hata
71dfbe2072
Use Hir::Def opt_def_id
2019-02-09 13:28:21 +09:00
bors
77435f9938
Auto merge of #3748 - phansch:uitest, r=oli-obk
...
Add a uitest subcommand to simplify UI test invocation
This makes running single tests a lot easier.
It's now
`TESTNAME=xxx cargo uitest`
instead of
`TESTNAME=xxx cargo test --test compile-test`
2019-02-09 04:09:25 +00:00
Hirokazu Hata
66f8fa320b
Add new Def type ConstParam
2019-02-09 11:42:13 +09:00
Philipp Hansch
f934f98111
Add a uitest subcommand to simplify UI test invocation
...
This allows to run
`TESTNAME=xxx cargo uitest`
instead of
`TESTNAME=xxx cargo test --test-compile-test`
2019-02-08 08:09:37 +01:00
bors
e176324fc5
Auto merge of #3665 - jsgf:master, r=oli-obk
...
Start making clippy easier to invoke in non-cargo contexts
Clippy (clippy-driver) currently has a couple of strong but unnecessary couplings with cargo. This series:
1. makes detection of check builds more robust, and
2. make clippy-driver use the --sysroot specified on the command line as its internal sysroot.
2019-02-06 15:43:07 +00:00
bors
4259377ea6
Auto merge of #3725 - mikerite:fix-2728, r=phansch
...
Fix `cast_sign_loss` false positive
This checks if the value is a non-negative constant before linting about
losing the sign.
Because the `constant` function doesn't handle const functions, we check if
the value is from a call to a `max_value` function directly. A utility method
called `get_def_path` was added to make checking for the function paths
easier.
Fixes #2728
2019-02-04 05:52:44 +00:00
Michael Wright
f3ee53d225
Document get_def_path
2019-02-04 07:30:24 +02:00
Michael Wright
c02367c4e9
Fix breakage due to rust-lang/rust#58079
...
The rustc change added HirId to a few nodes. As I understand it, the plan is
to remove the NodeId from these nodes eventually. Where the NodeId was
not being matched, I used `..` to try and avoid further breakage. Where it
was, I used `_` to make the fix easier when NodeId is removed.
2019-02-03 09:12:07 +02:00