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
ljedrz
7bc2e1d60d
fix: replace wrong id
2019-02-25 11:06:46 +01:00
ljedrz
8dac8a6ba4
HirIdify some lints
2019-02-24 20:49:43 +01: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
bzzzz
f9c6682827
Make needless_range_loop not applicable to structures without iter method
2019-02-20 00:10:25 -08:00
flip1995
10811d5d89
Fix breakage from rust-lang/rust#58296
2019-02-14 14:01:43 +01:00
Grzegorz
16881390e1
removing redundant closures in the whole project
2019-02-10 13:35:44 +01:00
Hirokazu Hata
71dfbe2072
Use Hir::Def opt_def_id
2019-02-09 13:28:21 +09:00
Hirokazu Hata
66f8fa320b
Add new Def type ConstParam
2019-02-09 11:42:13 +09: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
Michael Wright
3cf8c0b3b5
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-01-31 06:32:29 +02:00
Philipp Hansch
d0d7c5e922
cargo fmt
2019-01-29 19:56:19 +01:00
Philipp Hansch
0c6bdda562
Use built-in entry_fn detection over self-built
2019-01-29 08:19:05 +01:00
Philipp Hansch
c0a02691d8
cargo fmt
2019-01-29 08:19:05 +01:00
Philipp Hansch
c3980bf0bc
Add initial version of const_fn lint
2019-01-29 08:19:05 +01:00
bors
410d5ba6c3
Auto merge of #3700 - phansch:would_you_like_some_help_with_this_const_fn, r=oli-obk
...
Prevent incorrect cast_lossless suggestion in const_fn
`::from` is not a const fn, so applying the suggestion of
`cast_lossless` would fail to compile. The fix is to skip the lint if
the cast is found inside a const fn.
Fixes #3656
2019-01-28 14:30:18 +00:00
Matthias Krüger
3a96d6b603
rustup https://github.com/rust-lang/rust/pull/57907/
...
for file in `fd \.rs$` ; do sed -i s/span_suggestion_with_applicability/span_suggestion/g $file ; done
for file in `fd \.rs$` ; do sed -i s/span_suggestion_short_with_applicability/span_suggestion_short/g $file ; done
for file in `fd \.rs$` ; do sed -i s/span_suggestions_with_applicability/span_suggestions/g $file ; done
2019-01-27 13:33:56 +01:00
Philipp Hansch
8c416c3197
Prevent incorrect cast_lossless suggestion in const_fn
...
`::from` is not a const fn, so applying the suggestion of
`cast_lossless` would fail to compile. The fix is to skip the lint if
the cast is found inside a const fn.
2019-01-26 10:57:15 +01:00
Oliver Scherer
d6c806378e
Rustfmt all the things
2019-01-22 16:27:42 +01:00
Oliver Scherer
38cdf63acf
Don't make decisions on values that don't represent the decision
2019-01-22 15:28:51 +01:00
Oliver Scherer
3168023cc8
Rustup
2019-01-22 15:17:05 +01:00
Philipp Hansch
38d4ac7cea
Remove all copyright license headers
...
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
2019-01-08 21:46:39 +01:00
bors
756b32e1e2
Auto merge of #3623 - phansch:rustup, r=flip1995
...
rustup: https://github.com/rust-lang/rust/pull/55517
None
2019-01-03 22:29:09 +00:00
Philipp Hansch
d1fffe07c5
rustup: https://github.com/rust-lang/rust/pull/55517
2019-01-03 21:54:57 +01:00
John Kåre Alsaker
3af68f831a
Make clippy work with parallel rustc
2019-01-03 19:18:06 +01:00
Philipp Hansch
cc76384807
Some improvements to util documentation
2018-12-31 12:12:50 +01:00
Matthias Krüger
e590025f61
rustup https://github.com/rust-lang/rust/pull/56225/
...
item.name -> item.ident.name
2018-12-30 01:09:24 +01:00
Konrad Borowski
3f62fc3a7e
Remove crate:: prefixes from crate paths
...
This is somewhat misleading, as those are actually external crates,
and don't need a crate:: prefix.
2018-12-29 16:05:49 +01:00
bors
ada0b2b095
Auto merge of #3518 - sinkuu:redundant_clone_tw, r=phansch
...
Lint redundant clone of fields
Makes `redundant_clone` warn on unnecessary `foo.field.clone()` sometimes (it can detect an unnecessary clone only if the base of projection, `foo` in this case, is not used at all after that). This is enough for cases like `returns_tuple().0.clone()`.
2018-12-10 18:55:49 +00:00
Shotaro Yamada
109d4b1ab3
Lint redundant clone of projection
2018-12-10 08:48:14 +09:00
Matthias Krüger
273dc82872
run rustfmt
2018-12-09 12:03:10 +01:00
Philipp Hansch
d90cad24a1
Fix c_void false positive caused by libc refactoring
...
The path of `libc::c_void` has changes in 5c1a6b8a6d
The DefId path is now always platform specific like
`libc::windows::c_void`. This fixes our c_void detection to only check
the first and last elements.
2018-12-08 12:05:11 +01:00
Matthias Krüger
f13d23de41
rustup https://github.com/rust-lang/rust/pull/56502 ( .hir -> .hir() )
2018-12-08 12:05:09 +01:00
Matthias Krüger
45cbdf471d
rustup clippy build with latest rustc
...
(breakage due to 08f8faedd0
)
Fixes #3500
2018-12-06 16:44:22 +01:00
flip1995
3740da203b
Fix bugs and improve documentation
...
Some bugs and some documentation is unrelated to the Applicability change, but
these bugs were serious and the documentation was kind of required to
understand what's going on.
2018-11-27 15:29:23 +01:00
flip1995
9096269610
Add Applicability::Unspecified to span_lint_and_sugg functions
2018-11-27 15:29:23 +01:00
flip1995
fad267c3b3
Introduce snippet_with_applicability and hir_with_applicability functions
2018-11-27 15:29:14 +01:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
ff7da3264e
Merge pull request #3447 from phansch/small_rename
...
s/file_map/source_map
2018-11-22 15:08:13 +01:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
87ec0580f9
Merge branch 'master' into version_ids
2018-11-22 10:22:25 +01:00
Philipp Hansch
c4b08a5b0c
s/file_map/source_map
2018-11-22 07:53:59 +01:00
Matthias Krüger
f5929e0797
rust-lang-nursery/rust-clippy => rust-lang/rust-clippy
2018-11-22 04:40:09 +01:00
Oliver Scherer
617d861041
Enable rustup clippy to refer to the correct documentation
2018-11-21 13:33:42 +01:00
Matthias Krüger
396701613e
rustup https://github.com/rust-lang/rust/pull/55665 (pass contexts by reference)
2018-11-04 22:47:20 +01:00
Michael Wright
4e054ad320
Replace big if/else expression with match
2018-10-31 06:29:38 +02:00
Manish Goregaokar
a06296f836
Rustup to rustc 1.31.0-nightly (fb2446ad5 2018-10-30)
2018-10-30 04:06:37 +00:00
Philipp Hansch
af1548f58f
Don't expand macro in single_match suggestion
2018-10-27 15:47:56 +02:00
Philipp Hansch
aa7bcb9074
Don't expand macro in identity_conversion suggestion
2018-10-27 15:47:56 +02:00
Shotaro Yamada
9a150b4aa1
Use lint_root
2018-10-26 01:16:14 +09:00
Devon Hollowood
dcef9d0795
Fix stutter
lints
2018-10-11 15:42:22 -07:00
Devon Hollowood
2b9abc5daa
Fix cast_possible_wrap and cast_sign_loss warnings
2018-10-08 22:34:10 -07:00
Manish Goregaokar
e9c025ea70
Add license header to Rust files
2018-10-06 09:43:08 -07:00
Manish Goregaokar
cbde8201c5
Remove unused utils
2018-10-05 13:26:39 -07:00
Manish Goregaokar
c430147942
Fix push_item_path call (rustup to 4cf11765dc98536c6eedf33f2df7f72f6e161263)
2018-10-03 02:06:26 -07:00
Michael Wright
4b4d758ce0
Fix warnings in clippy_lints
2018-09-27 06:29:48 +02:00
Vitaly _Vi Shukela
92034e20c8
Use span_suggestion_with_applicability instead of span_suggestion
2018-09-20 14:38:47 +02:00
Eduard-Mihai Burtescu
9219fc6c5c
Reintroduce extern crate
for non-Cargo dependencies.
2018-09-15 11:10:51 +03:00
Manish Goregaokar
7b530c79b2
Add match on StructCtor
2018-09-14 12:41:20 +05:30
Matthias Krüger
554fe1ed5c
remove "clippy::" lint prefix from lint name in doc url.
...
Fixes #3132
2018-09-06 00:45:57 +02:00
Corey Farwell
05f637cf88
Make clippy_lints::{utils,consts} modules private, remove unused items.
2018-08-28 21:32:20 -05:00
Oliver Schneider
d99cea0f16
Update imports and rustup
2018-08-28 13:13:42 +02:00
Matthias Krüger
712d2d4fa1
rustup, fix breakage introduced by https://github.com/rust-lang/rust/pull/53581
2018-08-22 23:34:52 +02:00
Manish Goregaokar
76321d3300
codemap -> source_map
...
https://github.com/rust-lang/rust/pull/52953
2018-08-19 19:06:54 -07:00
Oliver Schneider
99a087bea5
Update to rustc master
2018-08-08 13:19:07 +02:00
Oliver Schneider
328fea3e0d
Rustup
2018-08-07 16:34:17 +02:00
Alex Crichton
8ef759e027
Fix fallout from rust-lang/rust#52841
2018-08-02 18:08:22 -07:00
Alex Crichton
40349b23ea
Fix breakage from rust-lang/rust#52949
2018-08-02 13:00:14 -07:00
Dale Wijnand
a1cce2d06a
Inline utils::in_external_macro
2018-07-24 10:38:58 +01:00
Dale Wijnand
b1fa7b91ba
Delegate utils::in_external_macro to rustc::lint::in_external_macro
2018-07-24 10:34:18 +01:00
Oliver Schneider
afd91248ed
Rustup
2018-07-23 13:01:12 +02:00
Manish Goregaokar
1f65617372
Merge branch 'macro-use' into HEAD
2018-07-20 00:52:01 -07:00
Manish Goregaokar
5918a3fc1e
Remove import of if_chain
2018-07-20 00:50:02 -07:00
Alexander Regueiro
4d2c838a32
Update to nightly
2018-07-20 03:59:07 +01:00
Manish Goregaokar
c7676356b8
Remove import of matches
2018-07-19 01:06:02 -07:00
Oliver Schneider
6992937002
Update for hir renamings in rustc
2018-07-16 15:07:39 +02:00
csmoe
12ded030b6
TyKind
2018-07-16 11:48:33 +02:00
csmoe
1bd17e4fa2
ExprKind
2018-07-16 11:46:37 +02:00
Mateusz Mikuła
48cb6e273e
Rustup
2018-06-29 09:49:05 +02:00
Mateusz Mikuła
1036df5699
Fix clippy_lints doc-tests
2018-06-25 21:22:53 +02:00
flip1995
203ad28021
resolve merge of NameAndSpan and ExpnInfo rust-lang/rust#51726
2018-06-25 12:25:20 +02:00
flip1995
d9a80d2f84
Resolve field, struct and function renaming
...
Addresses the errors produced by (re)moving, merging or renaming
structs, fields and methods by rust-lang/rust#48149 and rust-lang/rust#51580
2018-06-25 12:25:20 +02:00
Oliver Schneider
4839c790ae
Merge pull request #2844 from illicitonion/default_trait_access
...
Add default_trait_access lint
2018-06-19 10:10:20 +02:00
Oliver Schneider
7d672888fe
Version bump
2018-06-19 09:56:37 +02:00
Daniel Wagner-Hall
b24d75313e
Exclude generated code
2018-06-18 10:29:25 +01:00
Fabian Zaiser
81821acd59
Implement lint that checks for unidiomatic unwrap()
( fixes #1770 )
...
This checks for things like
if x.is_some() {
x.unwrap()
}
which should be written using `if let` or `match` instead.
In the process I moved some logic to determine which variables are
mutated in an expression to utils/usage.rs.
2018-06-08 05:29:25 +02:00
Philipp Hansch
17aff1d774
Fix cargo late bound region mismatch ICE
2018-06-07 07:42:45 +02:00
Mateusz Mikuła
424a33720d
Run rustfix
2018-05-30 10:15:50 +02:00
Mateusz Mikuła
a1c44e966e
Update to nightly 2018-05-22
...
Fixes #2788
2018-05-23 14:47:48 +02:00
Oliver Schneider
e0df4ccfc5
Use the new scoped tool attributes
2018-05-19 14:04:57 +02:00
Mateusz Mikuła
f0c823a85e
Rustup to 2018-05-16
2018-05-17 11:21:15 +02:00
Philipp Hansch
665cf96221
Rustup to 2018-05-11
2018-05-11 09:53:21 +02:00
Oliver Schneider
c1b39c4551
Merge pull request #2713 from alexreg/nightly-fix
...
Fixed build for latest rust master
2018-05-04 15:06:59 +02:00
Alexander Regueiro
00b549ad40
Fixed build for latest nightly (again)
2018-05-03 23:28:48 +01:00
Cyril Plisko
e94ec44ab3
Simplify some internal code
...
Addresses #2709
2018-05-01 20:33:32 +03:00
Alexander Regueiro
c7ff9334a6
Fixed build for latest nightly
2018-05-01 17:10:25 +01:00
Philipp Hansch
1712e18b77
Rustup to latest nightly
...
Due to https://github.com/rust-lang/rust/pull/48995 and
https://github.com/rust-lang/rust/pull/49894
2018-04-28 12:56:31 +02:00