Jeremy Stucki
3fc1ec1ffd
Refactor option handling
2019-09-04 16:19:59 +02: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
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
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
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
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
Lzu Tao
27c5348793
Rustup macro expansion and resolution
2019-07-12 00:26:36 +07: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
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
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
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
Lzu Tao
f67c3e4b2a
Make use of new outer_expn_info()
function
2019-06-01 16:25:51 +07:00
Oliver Scherer
73d1830812
Rustup to rustc 1.36.0-nightly (fa40a111f 2019-05-27)
2019-05-27 21:58:54 +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
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
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
0499184201
Ignore desugarings in macro checks
2019-05-10 23:40:42 -07:00
Matthias Krüger
d618637c05
Rustup to rustc 1.36.0-nightly (13fde05b1 2019-05-03)
2019-05-03 22:28:34 -07: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
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
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
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
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
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
Philipp Hansch
e1d47cd5f1
Refactor: Extract trait_ref_of_method
function
2019-03-07 08:17:43 +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
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