Konrad Borowski
9fe8a3e52e
Support array indexing expressions in unused write to a constant
2018-12-29 15:34:15 +01:00
Konrad Borowski
847898f18f
Mark writes to constants as side-effect-less
2018-12-29 15:18:51 +01:00
Konrad Borowski
44bf8e0c3d
Remove unsafe from consts clippy lints
2018-12-29 00:50:03 +01:00
Philipp Hansch
298aedf2f8
Fix suggestion for unnecessary_ref lint
2018-12-28 20:54:29 +01:00
Peter Fürstenau
6ee0e22204
Merge remote-tracking branch 'upstream/master'
2018-12-28 20:19:51 +01:00
Russell Greene
d127aed737
Merge new_without_default_derive into new_without_default
2018-12-28 10:57:58 -07:00
flip1995
909bfd3cd8
Match on ast/hir::ExprKind::Err
2018-12-28 13:31:19 +01:00
bors
721f688eff
Auto merge of #3577 - daxpedda:master, r=flip1995
...
Fix false positives for `implicit_return` and `empty_loop` on macro expansion.
This PR only fixes `implicit_return` and `empty_loop`.
But I suspect this bug may affect a lot of other lints.
2018-12-27 15:21:22 +00:00
Matthias Krüger
99454bc9a1
rustup https://github.com/rust-lang/rust/pull/57069
2018-12-27 11:19:20 +01:00
daxpedda
2d96ef1315
Rustfmt.
2018-12-26 18:13:33 +01:00
Matthias Krüger
7f5e17f3f1
fix a couple of ftrivial typos (NFC).
2018-12-25 18:22:34 +01:00
Philipp Krones
197914439a
Fix macro detection in empty_loop
.
...
Co-Authored-By: daxpedda <1645124+daxpedda@users.noreply.github.com>
2018-12-25 12:57:16 +01:00
daxpedda
a77bcadaa5
Changed macro_backtrace()
to in_macro()
.
2018-12-25 12:48:54 +01:00
daxpedda
b5587a894f
Fix lint detection on macro expansion.
2018-12-24 22:06:08 +01:00
Oliver Scherer
6db409fc0c
FIXME > TODO
2018-12-23 13:29:37 +01:00
Matthias Krüger
ce3e69da1c
rustup https://github.com/rust-lang/rust/pull/56992
2018-12-23 10:42:06 +01:00
bors
52820e588f
Auto merge of #3573 - Vlad-Shcherbina:map_clone_caveat, r=flip1995
...
Document map_clone known problems #498
(cherry picked from commit ada0d2c548
)
This was lost in relicensing (057243f16b
).
However, I [acknowledged](https://github.com/rust-lang/rust-clippy/issues/3099#issuecomment-416482309 ) relicensing so this cherry pick should be fine I guess.
2018-12-22 15:02:50 +00:00
bors
d9cc71fc42
Auto merge of #3341 - HMPerson1:possibly_missing_else, r=phansch
...
Teach `suspicious_else_formatting` about `if .. {..} {..}`
We essentially treat bare blocks `{..}` identically to `if .. {..}`, except for different lint messages.
Fixes #3044
2018-12-22 13:26:22 +00:00
Vlad-Shcherbina
d2c069de1e
Document map_clone known problems #498
...
(cherry picked from commit ada0d2c548
)
2018-12-22 13:44:35 +03:00
Mark Nieweglowski
c6031221e0
panic at map_unit_fn.rs:202 for map() without args
2018-12-22 00:58:07 -05:00
HMPerson1
05ae391e2c
Workaround rust-lang/rust#43081
2018-12-20 22:45:44 -05:00
HMPerson1
88564b743e
Teach suspicious_else_formatting
about if .. {..} {..}
2018-12-20 22:45:37 -05:00
Daniel Silverstone
5875ba3364
mutex_atomic: Correct location of AtomicBool and friends
...
The AtomicBool, AtomicUsize, and friends, types live in the
`std::sync::atomic` module, rather than `std::atomic` as the lint
help text used to say.
2018-12-19 20:47:50 +00:00
Peter Fürstenau
65c35333a4
Only print out question_mark lint when it actually triggered
2018-12-19 20:55:01 +01:00
Peter Fürstenau
e722b1338e
Reinserted commata
2018-12-19 20:31:08 +01:00
bors
61de562454
Auto merge of #3554 - klausi:module_name_repeat, r=oli-obk
...
chore(module_name_repeat): Rename stutter lint to module_name_repeat to avoid ableist language
See #3521
2018-12-18 13:28:12 +00:00
Peter Fürstenau
ee0856cbeb
Recomend .as_ref()?
in certain situations
2018-12-18 13:57:38 +01:00
Peter Fürstenau
8b0ea22885
Deduplicate some code?
2018-12-18 13:57:38 +01:00
bors
176778fe92
Auto merge of #3556 - lucasloisp:bool-ord-comparison, r=oli-obk
...
Implements lint for order comparisons against bool (#3438 )
As described on issue #3438 , this change implements linting for `>` and `<` comparisons against both `boolean` literals and between expressions.
2018-12-18 10:11:08 +00:00
Wilco Kusee
24ef8db402
Do not mark as_ref as useless if it's followed by a method call
2018-12-17 21:33:50 +01:00
Lucas Lois
de42dfbab7
Changes lint sugg to bitwise and operator &
2018-12-17 15:32:24 -03:00
flip1995
a44adaa5ed
Rename lint to MODULE_NAME_REPETITIONS
2018-12-17 14:29:19 +01:00
flip1995
0516c2e04a
Move renaming to the right place
2018-12-17 13:58:41 +01:00
Lucas Lois
bc48890b47
Implements lint for order comparisons against bool
2018-12-16 21:43:32 -03:00
Klaus Purer
355018d086
fix(module_name_repeat): Try to register renamed lint, not valid yet
2018-12-16 22:49:46 +01:00
daxpedda
35058287ce
Fix implicit_return
false positives.
2018-12-16 15:42:02 +01:00
Klaus Purer
15b9e9f23a
chore(moduel_name_repeat): Rename stutter lint to module_name_repeat to avoid ableist language
2018-12-16 14:10:53 +01:00
bors
a416c5e0f7
Auto merge of #3545 - Kampfkarren:vec_boxed_sized, r=flip1995
...
Adds lint for Vec<Box<T: Sized>>
This adds, and subsequently closes #3530 . This is the first time I've ever worked with anything remotely close to internal Rust code, so I'm very much unsure about the if_chain! to figure this out!
I can't get rustfmt working on WSL with nightly 2018-12-07:
`error: component 'rustfmt' for target 'x86_64-unknown-linux-gnu' is unavailable for download`
2018-12-14 12:10:48 +00:00
flip1995
d866f31678
rustup rust-lang/rust#52994
...
s/trim_left/trim_start/
s/trim_right/trim_end/
2018-12-14 12:35:44 +01:00
Michael Wright
df73348354
Merge branch 'master' into fix-3514
2018-12-14 07:16:26 +02:00
Kampfkarren
985eba08a5
Line length fix
2018-12-13 10:46:21 -08:00
Kampfkarren
db00c3320f
Remove references to sized for end users
2018-12-13 10:18:17 -08:00
Kampfkarren
9fc914cf4d
Remove DUMMY_SP
2018-12-13 09:37:00 -08:00
Kampfkarren
616395f40b
Add suggestion for replacement
2018-12-13 09:34:16 -08:00
Kampfkarren
ab070508be
Lint for Vec<Box<T: Sized>> - Closes #3530
2018-12-13 07:43:13 -08:00
bors
379c934f3f
Auto merge of #3535 - sinkuu:fixes, r=phansch
...
Fix some problems
Fixes #2892 , #3199 , #2841 , #3476
2018-12-12 19:17:09 +00:00
bors
777c9099e7
Auto merge of #3510 - phansch:fix_doc_markdown_mixed_case, r=flip1995
...
Fix doc_markdown mixed case false positive
Fixes #2343
2018-12-12 18:36:38 +00:00
Philipp Hansch
778723630c
Fix doc_markdown mixed case false positive
2018-12-12 19:25:27 +01:00
bors
7c823cabab
Auto merge of #3450 - phansch:structured_sugg_for_explicit_write, r=flip1995
...
Add suggestion for explicit_write lint
Closes #2083
2018-12-12 18:11:13 +00:00
Shotaro Yamada
eba44e1c67
question_mark: Suggest Some(opt?) for if-else
2018-12-12 18:13:21 +09:00
Shotaro Yamada
eb54c1a9a0
redundant_field_names: Do not trigger on path with type params
...
Fixes #3476
2018-12-12 17:41:52 +09:00
Shotaro Yamada
28635ff04b
question_mark: Lint only early returns
2018-12-12 17:41:51 +09:00
Shotaro Yamada
05d07155b7
question_mark: Fix applicability
2018-12-12 17:40:25 +09:00
Philipp Hansch
1cfbadb029
Fix doc_markdown off by one issue
2018-12-12 08:21:13 +01:00
Shotaro Yamada
bcbbb4d09b
new_without_default, partialeq_ne_impl: Use span_lint_node
...
Fixes #2892 , fixes #3199
2018-12-12 16:08:05 +09:00
Philipp Hansch
499aad1e04
cargo fmt and remove stabilized feature
2018-12-12 07:31:04 +01:00
Philipp Hansch
752724546a
Make suggestion Applicability::MachineApplicable
2018-12-12 07:31:04 +01:00
Philipp Hansch
9a6216ed05
Address review feedback
...
* Fix typo
* Handle None value instead of using `unwrap()`
* `pop()` instead of `x.truncate(x.len() - 1)`
2018-12-12 07:31:04 +01:00
Philipp Hansch
5f007a88b4
Extract method
2018-12-12 07:31:04 +01:00
Philipp Hansch
7e7a33c726
Check array lengths to prevent OOB access
2018-12-12 07:31:04 +01:00
Philipp Hansch
c4c9d9fc62
Add suggestion for explicit_write lint
2018-12-12 07:31:01 +01:00
Philipp Hansch
ee2abc36a3
Add 'CamelCase' to doc_valid_idents
2018-12-11 19:37:43 +01:00
Michael Wright
c6505aa160
Fix write_with_newline escaping false positive
...
Fixes #3514
2018-12-11 08:44:49 +02:00
bors
0fd7fe9a77
Auto merge of #3511 - phansch:remove_allow_doc_markdown, r=phansch
...
Remove allow(doc_markdown) in excessive_precision.rs
Closes #3299
2018-12-10 19:21:25 +00: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
e7d18084fb
Only check the assignment found at last
...
If there are more than one such assignment, the last one may be
the one supplied to `clone` method.
Makes `find_stmt_assigns_to` internally reverses the iterator to make
the intent to "iterate statements backward" clear.
2018-12-10 15:59:21 +09:00
Shotaro Yamada
fd9f5df36c
Add comment and rename
2018-12-10 15:48:34 +09:00
Shotaro Yamada
22f396a1c1
Apply redundant_clone on clippy
2018-12-10 08:48:14 +09: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
Shotaro Yamada
790e611c9c
Cleanup
2018-12-09 19:18:35 +09:00
Philipp Hansch
fe3519e0dd
Swap if branches
2018-12-08 12:09:32 +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
Philipp Hansch
26602ddff4
Merge pull request #3336 from HMPerson1/clone_on_copy_deref
...
Fix `clone_on_copy` not detecting derefs sometimes
2018-12-08 09:59:02 +01:00
Philipp Hansch
a73d051227
Remove allow(doc_markdown) in excessive_precision.rs
2018-12-07 22:47:12 +01:00
Philipp A
2fed8d9f1d
typo: emum → enum
2018-12-07 12:24:59 +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
Philipp Hansch
c4ef06a9b6
Merge pull request #3497 from daxpedda/master
...
Fix bug in `implicit_return`.
2018-12-06 14:13:20 +01:00
daxpedda
a4ec7be06f
Forgot to remove some debugging code ...
2018-12-06 13:23:42 +01:00
daxpedda
d048e15835
Improved code noted by clippy.
2018-12-06 13:21:04 +01:00
daxpedda
973d676cd1
Fix bug in implicit_return
.
...
Bug was already covered by test, but test was not checked for.
2018-12-06 12:22:54 +01:00
Felix Kohlgrüber
a8a0b236b5
fix #3482 and add ui test for it
2018-12-06 11:07:10 +01:00
Philipp Hansch
f93591294d
Merge pull request #3494 from daxpedda/master
...
Added `IMPLICIT_RETURN` lint.
2018-12-06 07:12:01 +01:00
daxpedda
b0f3ed2b80
Added additional reasoning to Why is this bad?
.
...
Added comment to explain usage of MIR.
2018-12-05 15:01:19 +01:00
daxpedda
aed2b986e6
Renamed to implicit_return
.
...
Covered all other kinds besides `ExprKind::Lit`.
Added check for replacing `break` with `return`.
2018-12-05 14:39:09 +01:00
flip1995
36ee92780d
Fix ty::TyKind usage
2018-12-05 12:47:19 +01:00
flip1995
20a07f6d80
Fix TyKind::<kind> usage in codebase
2018-12-05 12:47:10 +01:00
daxpedda
19db2f1a32
Appeasing the Test Gods.
...
Seems I'm not smart enough to run the tests locally before committing.
2018-12-05 11:26:40 +01:00
daxpedda
978f8c65ee
Renamed forced_return
to missing_returns
.
...
Better clarification in the docs.
Ran `update_lints`.
2018-12-05 10:54:21 +01:00
daxpedda
d5d6692288
Added FORCED_RETURN
lint.
2018-12-05 01:59:09 +01:00
Philipp Krones
3f24cdf10f
Merge pull request #3490 from phansch/extract_single_match_else_ui_test
...
Extract single_match_else UI test
2018-12-04 14:57:19 +01:00
Philipp Hansch
68bb900eba
Merge pull request #3473 from lucasloisp/additional-bool-comparisons
...
Adds inequality cases to bool comparison (#3438 )
2018-12-04 07:26:29 +01:00
Philipp Hansch
8b2eb06df3
Merge pull request #3488 from phansch/fix_cargo_lint_bug
...
Fix wildcard_dependencies false positive
2018-12-04 07:24:11 +01:00
Philipp Hansch
3f72d4d630
Extract single_match_else UI test
...
There's only one test currently.
I also updated the lint doc with a 'good' example and changed the lint
help text a bit.
cc #2038
2018-12-04 07:20:13 +01:00
Philipp Hansch
46ee676139
cargo fmt
2018-12-04 06:47:41 +01:00
Lucas Lois
3930148059
Adds inequality cases to bool comparison lint
...
The lint now checks cases like `y != true`
2018-12-03 16:32:11 -03:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
c00210d7ba
Merge pull request #3478 from dtolnay/setlen
...
Remove unsafe_vector_initialization lint
2018-12-03 12:42:31 +01:00
David Tolnay
e632a1946e
Remove unsafe_vector_initialization lint
2018-12-03 02:48:37 -08:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
13438b6866
Merge pull request #3479 from dtolnay/literal
...
Downgrade large_digit_groups to pedantic
2018-12-03 11:06:56 +01:00
Philipp Hansch
ef64c762d2
Fix wildcard_dependencies false positive
...
This now only checks for wildcard_dependencies if the source is a
non-git source.
I tried adding a compiletest suite for the cargo lints, but I was unable
to override the `Cargo.toml` of the original executable.
I tested this manually by modifying the main `Cargo.toml`.
Fixes #3458
2018-12-03 08:12:35 +01:00
Philipp Hansch
ebd508e0ac
Fix rustfmt format
2018-12-03 07:13:00 +01:00
David Tolnay
c00dcd03d7
Downgrade large_digit_groups to pedantic
...
I believe if the user already decided to put underscores in their
literal, Clippy should be willing to believe that they put a number of
underscores that they felt was readable.
2018-12-01 17:08:42 -08:00
David Tolnay
8b1f69a485
Downgrade unsafe_vector_initialization to restriction
...
This lint looks for:
let mut vec = Vec::with_capacity(len);
vec.set_len(len);
The suggested replacement is `vec![0; len]`.
This is far too opinionated to be a deny-by-default lint because the performance
characteristics of the suggested replacement are totally different.
I am not convinced that this lint has value beyond what deny(unsafe_code) gives
you. Unsafe code is unsafe but please don't deny-by-default lint it if that's
the only reason.
2018-12-01 16:21:02 -08:00
Matthias Krüger
c38bac89e9
remove macro_at_most_once_rep feature attribute since it's stable
...
Warning was:
warning: the feature `macro_at_most_once_rep` has been stable since 1.32.0 and no longer requires an attribute to enable
--> clippy_lints/src/lib.rs:19:12
|
19 | #![feature(macro_at_most_once_rep)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(stable_features)] on by default
2018-11-30 09:14:18 +01:00
flip1995
63fa5d24e1
Fix some formatting issues
2018-11-27 21:49:09 +01:00
flip1995
1751d2496d
Run rustfmt on clippy_lints
2018-11-27 21:14:15 +01:00
flip1995
87e72a5861
Fix NAIVE_BYTECOUNT applicability
2018-11-27 17:31:17 +01:00
flip1995
6eb8e6d7c5
Fix dogfood error
2018-11-27 16:59:52 +01:00
flip1995
adc638ef33
Change Applicability of MISTYPED_LITERAL_SUFFIX
2018-11-27 16:59:39 +01:00
flip1995
4e74eef6e9
Add applicability level to (nearly) every span_lint_and_sugg function
2018-11-27 15:29:23 +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
1e2291c90c
Merge pull request #3365 from gnieto/lint/slow-initialization
...
Add slow vector initializations lint
2018-11-26 13:37:46 +01:00
Matthias Krüger
ae32c877a5
constants: add u128 i128 builtin types and fix outdated url
2018-11-26 01:12:12 +01:00
Guillem Nieto
dc35841be4
Update lints
2018-11-25 14:36:04 -08:00
Guillem Nieto
5fa04bc3cd
Lint only the first statment/expression after alloc
...
Instead of searching for all the successive expressions after a vector
allocation, check only the first expression.
This is done to minimize the amount of false positives of the lint.
2018-11-25 14:34:23 -08:00
Guillem Nieto
39b02fdcd2
Fix some warnings related to Self
2018-11-25 14:34:23 -08:00
Guillem Nieto
5b77ee95dc
Rename some symbols
...
Renamed some symbols in order to make them a little bit more accurate.
2018-11-25 14:34:23 -08:00
Guillem Nieto
2753f1cbd4
Split lint into slow and unsafe vector initalization
2018-11-25 14:34:23 -08:00
Guillem Nieto
9b4bc3b6ef
Add unsafe set_len initialization
2018-11-25 14:34:23 -08:00
Guillem Nieto
e0ccc9d9af
Add slow zero-filled vector initialization lint
...
Add lint to detect slow zero-filled vector initialization. It detects
when a vector is zero-filled with extended with `repeat(0).take(len)`
or `resize(len, 0)`.
This zero-fillings are usually slower than simply using `vec![0; len]`.
2018-11-25 14:34:23 -08:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
69d09fbfc6
Merge pull request #3439 from dtolnay/npbv
...
Downgrade needless_pass_by_value to allow by default
2018-11-24 10:16:38 +01:00
Philipp Hansch
754b4c0723
Merge pull request #3452 from matthiaskrgr/rustup
...
rustup https://github.com/rust-lang/rust/pull/54071/
2018-11-23 10:38:20 +01:00
Matthias Krüger
311c8e29b1
rustup https://github.com/rust-lang/rust/pull/54071/
2018-11-23 10:05:51 +01:00
Matthias Krüger
1ee0c1a029
dependencies: update pulldown-cmark from 0.1 to 0.2
2018-11-22 18:04:34 +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
Wayne Warren
1fed72bad4
Address 'clippy::single-match' dogfood lint
2018-11-21 07:52:02 -06:00
Philipp Krones
d4a6ee4a0c
Fix nit
...
Co-Authored-By: waynr <wayne.warren.s@gmail.com>
2018-11-21 07:52:02 -06:00
Wayne Warren
cb5e327c58
Address travis CI lint failure
2018-11-21 07:52:02 -06:00
Wayne Warren
92f7f9061c
issue#3318 run trivially_copy_pass_by_ref for traits
2018-11-21 07:52:02 -06:00
Oliver Scherer
617d861041
Enable rustup clippy to refer to the correct documentation
2018-11-21 13:33:42 +01:00
Matthias Krüger
4aae76464c
rustup https://github.com/rust-lang/rust/pull/52591
2018-11-21 13:29:23 +01:00
David Tolnay
e4be2b4e64
Downgrade needless_pass_by_value to allow by default
...
I noticed that I suppress this lint in many of my projects.
https://github.com/search?q=needless_pass_by_value+user%3Adtolnay&type=Code
https://github.com/search?q=needless_pass_by_value+user%3Aserde-rs&type=Code
Upon further inspection, this lint has a *long* history of false
positives (and several remaining).
Generally I feel that this lint is the definition of pedantic and should
not be linted by default.
#[derive(Debug)]
enum How {
ThisWay,
ThatWay,
}
// Are we really better off forcing the call sites to write f(&_)...?
fn f(how: How) {
println!("You want to do it {:?}", how);
}
fn main() {
f(How::ThatWay);
}
2018-11-21 03:11:22 -08:00
bors[bot]
64ff255ac6
Merge #3432
...
3432: match_ref_pats: don't emit suggestions inside of a macro r=Manishearth a=flip1995
Fixes #2636
Co-authored-by: flip1995 <hello@philkrones.com>
2018-11-19 21:07:49 +00:00
Matthias Krüger
3a11cd4289
remove unused allow() attributes, NFC
2018-11-17 13:47:46 +01:00
flip1995
1000fc5120
Don't emit suggestion when inside of a macro
2018-11-15 17:03:17 +01:00
Matthias Krüger
2d0d41ff29
rustup https://github.com/rust-lang/rust/pull/55852/
2018-11-15 16:50:28 +01:00
bors[bot]
a2c9d10da5
Merge #3419
...
3419: Linter to check that all common metadata is included r=flip1995 a=ysimonson
Addresses https://github.com/rust-lang-nursery/rust-clippy/issues/1793
This is not ready to be merged yet. First the associated changes to `cargo_metadata` need to be merged: https://github.com/oli-obk/cargo_metadata/pull/55
Co-authored-by: Yusuf Simonson <simonson@gmail.com>
2018-11-15 14:18:12 +00:00
Anton
93324f1acf
Fix "too" -> "foo" typo in format.rs
2018-11-14 14:08:52 +01:00
Michael Wright
3ba4c3a9b1
Fix use_self
violation
2018-11-14 08:43:35 +02:00
Michael Wright
e2e892b59b
Fix wrong suggestion for redundant_closure_call
...
Fixes #1684
2018-11-14 08:01:39 +02:00
Yusuf Simonson
866caabb7a
Check for common metadata
2018-11-13 08:43:30 -05:00
Michael Wright
5ade9ff44e
Fix use_self
false positive on use
statements
2018-11-13 06:15:33 +02:00
Michael Wright
460c2b317b
Fix use_self
false positive
...
This fixes the first error reported in issue #3410 .
2018-11-10 10:57:11 +02:00
Michael Wright
c20e17f8ee
Remove +
from has_unary_equivalent
...
Rust doesn't has a unary + operator!
2018-11-06 07:05:13 +02:00
Michael Wright
2353f24095
Merge branch 'master' into fix-missing-comma-fp
2018-11-06 07:00:54 +02:00
Philipp Hansch
90f31e21ab
RIIR update lints: Add check mode (update_lints.py rewrite complete)
...
This finishes up the rewrite of `update_lints.py` in Rust. More
specifically, this
* adds the `--check` flag and handling to clippy_dev
* tracks file changes over the different calls to `replace_region_in_file`
* only writes changes to files if the `--check` flag is *not* used
* runs `./util/dev update_lints --check` on CI instead of the old script
* replaces usage of the `update_lints.py` script with an error
`./util/dev update_lints` behaves 99% the same as the python script.
The only difference that I'm aware of is an ordering change to
`clippy_lints/src/lib.rs` because underscores seem to be sorted
differently in Rust and in Python.
🏁
2018-11-05 07:18:47 +01:00
bors[bot]
7e417d4cbd
Merge #3353
...
3353: float support added for mistyped_literal_suffixes lint r=mikerite a=Maxgy
I implemented the mistyped_literal_suffixes lint for float literals.
```
#![allow(unused_variables)]
fn main() {
let x = 1E2_32;
let x = 75.22_64;
}
```
Given the above, the additional check suggests the variables to be written as `let x = 1E2_f32` and `let x = 75.22_f64`.
Fixes #3167
Co-authored-by: Maxwell Anderson <maxwell.brayden.anderson@gmail.com>
2018-11-05 03:58:15 +00: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
Maxwell Anderson
3e0de1745d
changed into_iter to iter and fixed a lint check
2018-11-04 10:39:54 -07:00
Michael Wright
a3ab512576
Fix collapsible_if
error
2018-11-04 10:48:24 +02:00
Michael Wright
0c1ffc1d1f
Fix possible_missing_comma
false positives
...
`possible_missing_comma` should only trigger when the binary operator has
unary equivalent. Otherwise, it's not possible to insert a comma without
breaking compilation. The operators identified were `+`, `&`, `*` and `-`.
This fixes the specific examples given in issues #3244 and #3396
but doesn't address the conflict this lint has with the style of starting
a line with a binary operator.
2018-11-04 10:02:49 +02:00
Matthias Krüger
b59b60c8ae
rustup https://github.com/rust-lang/rust/pull/55330/
2018-11-03 18:50:23 +01:00
bors[bot]
486300b89d
Merge #3400
...
3400: Fix a false-positive of needless_borrow r=phansch a=sinkuu
Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
2018-11-03 08:34:13 +00:00
flip1995
cadb367a5c
Also lint cfg_attr(.., rustfmt::skip)
2018-11-02 19:50:24 +01:00
flip1995
a770d8edd0
Differ between inner and outer attributes
2018-11-02 19:49:58 +01:00
flip1995
e1cf160e2a
Add cfg_attr(rustfmt) lint
2018-11-02 19:49:57 +01:00
kennytm
5563bd6cc3
Addressed comments.
2018-11-02 22:53:57 +08:00
kennytm
2b2acf1002
Fix dogfood error.
2018-11-02 22:53:57 +08:00
kennytm
2d1c9313b0
Added lints into_iter_on_ref
and into_iter_on_array
. Fix #1565 .
2018-11-02 22:53:56 +08:00
flip1995
32396f6e18
Allow single_match_else
2018-11-02 14:00:46 +01:00
flip1995
014cf3d6e0
Fix typos
2018-11-02 13:49:10 +01:00
flip1995
cf89c40e34
Fix dogfood error
2018-11-02 13:49:10 +01:00
flip1995
ea4a80f215
Fix typo and indentation
2018-11-02 13:49:10 +01:00
flip1995
f6d57862c7
Add new lint: unknwon_clippy_lintsg
2018-11-02 13:49:09 +01:00
Matthias Krüger
df7cff31dc
clippy: fix pedantic warnings and run clippy::pedantic lints on the codebase.
...
Turn on pedantic lints in dogfood and base tests.
needless_bool: fix clippy::items-after-statements
redundant_pattern_matching: fix clippy::similar-names
mods.rs: fix clippy::explicit-iter-loop
returns.rs: allow clippy::cast-possible-wrap
Fixes #3172
2018-11-02 12:16:43 +01:00
bors[bot]
7c86a9c05c
Merge #3387
...
3387: Replace big if/else expression with match r=flip1995 a=mikerite
Co-authored-by: Michael Wright <mikerite@lavabit.com>
2018-11-02 07:58:00 +00:00
Shotaro Yamada
d4370f8b07
Fix a false-positive of needless_borrow
2018-11-02 15:58:54 +09:00
bors[bot]
0ad5b9b9e0
Merge #3388
...
3388: RIIR update lints: Generate deprecated lints r=phansch a=phansch
The update script now also generates the 'register_removed' section in
`clippy_lints/src/lib.rs`.
Also, instead of using `let mut store ...`, I added a new identifier
line so that the replacement will continue to work in case `let mut
store ...` ever changes.
cc #2882
Co-authored-by: Philipp Hansch <dev@phansch.net>
2018-11-02 06:29:40 +00:00
Maxwell Anderson
b6b97e5c1f
format code
2018-11-01 15:43:40 -06:00
Maxwell Anderson
6c1f89e8dc
Merge remote-tracking branch 'upstream/master'
2018-11-01 15:26:38 -06:00
Philipp Hansch
beb44ef6ca
Fix clippy build failure on latest master
2018-11-01 20:35:23 +01:00
Maxwell Anderson
02340cc891
fix comment spacing
2018-11-01 12:35:01 -06:00
Michael Wright
0a41dfd946
Use slice patterns instead of padding
2018-11-01 07:06:47 +02:00
Maxwell Anderson
98ce3348d9
change single char str to char
2018-10-31 18:09:56 -06:00
Maxwell Anderson
3c22b2314c
Merge remote-tracking branch 'upstream/master'
2018-10-31 16:48:47 -06:00
Maxwell Anderson
f4b919cad7
add lint to lintarray macro
2018-10-31 16:48:24 -06:00
Maxwell Anderson
6b895b8267
Revert "small fix"
...
This reverts commit b1abc81a60
.
2018-10-31 16:39:12 -06:00
bors[bot]
73458aebe3
Merge #3368
...
3368: added downsides to "known problems" for get_unwrap lint r=flip1995 a=humean
As a beginner I found this lint to be confusing because I was not sure how the `Option` type disappeared as conceptually I know that my `.get()` and Index could fail. Initially I thought maybe the compiler or clippy was smart enough to understand that it was impossible for my `.get()` to fail in this particular case, but it was explained to me that using the Index syntax is just shorthand for directly unwrapping the value:
https://doc.rust-lang.org/src/std/collections/hash/map.rs.html#1547
For beginners or users trying to iterate quickly it seems common to litter your code with `unwrap` or `except` as placeholders for where some explicit error handling might need to take place. I think it should be warned that using Index is merely more concise, but doesn't at all reduce the risk of panics and might in fact cause you to miss handling them in a future refactor.
Co-authored-by: Michael Rutter <michael.john.rutter@gmail.com>
Co-authored-by: Michael Rutter <humean@users.noreply.github.com>
2018-10-31 10:21:51 +00:00
bors[bot]
c8308c92b6
Merge #3378
...
3378: Fix lint_without_lint_pass r=phansch a=mikerite
Co-authored-by: Michael Wright <mikerite@lavabit.com>
Co-authored-by: flip1995 <hello@philkrones.com>
2018-10-31 07:18:42 +00:00
Philipp Hansch
64bd658516
RIIR update lints: Generate deprecated lints
...
The update script now also generates the 'register_removed' section in
`clippy_lints/src/lib.rs`.
Also, instead of using `let mut store ...`, I added a new identifier
line so that the replacement will continue to work in case `let mut
store ...` ever changes.
2018-10-31 08:03:50 +01:00
bors[bot]
b144c7f35d
Merge #3370
...
3370: bool_comparison triggers 3 times on same code r=phansch a=mrbuzz
Fix #3335
Co-authored-by: Giorgio Gambino <gambnio.giorgio@gmail.com>
2018-10-31 06:48:49 +00:00
Michael Wright
4e054ad320
Replace big if/else expression with match
2018-10-31 06:29:38 +02:00
Matthias Krüger
650eb09981
docs: use_self: hightlight the "should be" code sample as rust code as well.
2018-10-31 01:42:17 +01:00
Manish Goregaokar
a06296f836
Rustup to rustc 1.31.0-nightly (fb2446ad5 2018-10-30)
2018-10-30 04:06:37 +00:00
Giorgio Gambino
c0c1f1f7fa
Fix #3335 rev2: bool_comparison triggers 3 times on same code
2018-10-29 22:23:45 +01:00
flip1995
1e43c3bb9f
Register MISTYPED_LITERAL_SUFFIXES lint
2018-10-29 20:54:21 +01:00
flip1995
a7fc6799df
Rewrite registered lint collection
2018-10-29 20:44:45 +01:00
Michael Wright
267d5d3433
Fix lint_without_lint_pass
2018-10-29 20:28:06 +01:00
bors[bot]
14d2700b6f
Merge #3217 #3366
...
3217: Fix string_lit_as_bytes lint for macros r=phansch a=yaahallo
Prior to this change, string_lit_as_bytes would trigger for constructs
like `include_str!("filename").as_bytes()` and would recommend fixing it
by rewriting as `binclude_str!("filename")`.
This change updates the lint to act as an EarlyLintPass lint. It then
differentiates between string literals and macros that have bytes
yielding alternatives.
Closes #3205
3366: Don't expand macros in some suggestions r=oli-obk a=phansch
Fixes #1148
Fixes #1628
Fixes #2455
Fixes #3023
Fixes #3333
Fixes #3360
Co-authored-by: Jane Lusby <jlusby42@gmail.com>
Co-authored-by: Philipp Hansch <dev@phansch.net>
2018-10-28 17:13:34 +00:00
Giorgio Gambino
7cfde9cfa9
Fix #3335 : bool_comparison triggers 3 times on same code
2018-10-28 15:37:39 +01:00
Matthias Krüger
6eb1f23555
rustup: fix build with rustc 1.31.0-nightly (cae6efc37 2018-10-27)
2018-10-28 13:56:50 +01:00
Michael Rutter
232a483331
more consistent use of terminology; trait > syntax
2018-10-28 12:31:02 +00:00
Michael Rutter
061a48321c
added downsides to "known problems" for get_unwrap lint
2018-10-28 08:12:47 +00:00
Maxwell Anderson
183e19a1c3
Merge remote-tracking branch 'upstream/master'
2018-10-27 12:50:12 -06:00
Philipp Hansch
840e50e97f
Don't expand macro in or_fun_call suggestion
2018-10-27 15:47:56 +02: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
Jane Lusby
19ac2e94c6
fix: correctly reconstruct raw strings
2018-10-26 09:12:01 -07:00
Jane Lusby
f9020bb2dd
fix: extra semicolon, only create callsite once
2018-10-26 09:12:01 -07:00
Jane Lusby
c209fc9349
Fix string_lit_as_bytes lint for macros
...
Prior to this change, string_lit_as_bytes would trigger for constructs
like `include_str!("filename").as_bytes()` and would recommend fixing it
by rewriting as `binclude_str!("filename")`.
This change updates the lint to act as an EarlyLintPass lint. It then
differentiates between string literals and macros that have bytes
yielding alternatives.
Closes #3205
2018-10-26 09:12:01 -07:00
bors[bot]
457e7f12e9
Merge #3355
...
3355: Lint to remove redundant `clone()`s r=oli-obk a=sinkuu
This PR adds lint `redundant_clone`. It suggests to remove redundant `clone()` that clones a owned value that will be dropped without any usage after that.
Real-world example: https://github.com/rust-lang/rust/compare/7b0735a..sinkuu:redundant_clone2
Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
2018-10-26 10:36:43 +00:00
bors[bot]
ead29847ff
Merge #3357
...
3357: Check existential types in `use_self` r=oli-obk a=HMPerson1
Fixes #3231
Co-authored-by: HMPerson1 <hmperson1@gmail.com>
2018-10-26 08:48:12 +00:00
Shotaro Yamada
9034b87a53
Move in_macro check
2018-10-26 03:07:29 +09:00
Shotaro Yamada
a828692780
Use BasicBlockData::terminator
2018-10-26 01:27:28 +09:00
Shotaro Yamada
6d6ff88585
Refactor
2018-10-26 01:16:14 +09:00
Shotaro Yamada
9a150b4aa1
Use lint_root
2018-10-26 01:16:14 +09:00
Shotaro Yamada
24d3f5b48f
Implement visit_basic_block_data
2018-10-26 01:16:14 +09:00
Shotaro Yamada
3ca0895920
Add redundant_clone lint
2018-10-26 01:15:55 +09:00
Matthias Krüger
b8a9099011
Revert "new_ret_no_self: add sample from #3313 to Known Problems section."
...
This reverts commit fd2f6dd382
.
Issue #3313 has been fixed.
2018-10-25 13:39:02 +02:00
bors[bot]
a87e1b02ab
Merge #3331
...
3331: Disable arithmetic lints in constant items r=oli-obk a=pengowen123
Currently this will not catch cases in associated constants. I'm not sure whether checking spans is the best way to solve this issue, but I don't think it will cause any problems.
Fixes #1858
Co-authored-by: Owen Sanchez <pengowen816@gmail.com>
2018-10-25 09:38:00 +00:00
Philipp Krones
5dbca1f6b1
Add Applicability
2018-10-24 23:39:54 -04:00
HMPerson1
aabf8083bd
Add lint for calling mem::discriminant
on a non-enum type
2018-10-24 23:39:54 -04:00
HMPerson1
3db14f182c
Check existential types in use_self
2018-10-24 23:32:33 -04:00
Owen Sanchez
0b9e9c9e3d
Disable arithmetic lints in constant items
2018-10-24 20:27:26 -07:00
bors[bot]
4c6201dceb
Merge #3312
...
3312: OUT_OF_BOUNDS_INDEXING false negative r=phansch a=JoshMcguigan
fixes #3102
Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2018-10-24 21:17:43 +00:00
bors[bot]
44fb29a356
Merge #3356
...
3356: Fix warnings introduced by #3349 r=flip1995 a=flip1995
I missed these warnings during review, should have checked the Travis log first.
Co-authored-by: flip1995 <hello@philkrones.com>
2018-10-24 15:25:12 +00:00
bors[bot]
bce190558f
Merge #3338
...
3338: new_ret_no_self false positives r=flip1995 a=JoshMcguigan
~~WORK IN PROGRESS~~
I plan to fix all of the false positives in #3313 in this PR, but I wanted to open it now to start gathering feedback.
In this first commit, I've updated the lint to allow tuple return types as long as `Self` shows up at least once, in any position of the tuple. I believe this is the broadest possible interpretation of what should be allowed for tuple return types, but I would certainly be okay making the lint more strict.
fixes #3313
Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2018-10-24 14:42:40 +00:00
flip1995
57a18b6520
Fix warnings introduced by #3349
2018-10-24 16:18:01 +02:00
bors[bot]
319b75c75b
Merge #3349
...
3349: Fixes #3347 : Lint for wildcard dependencies in Cargo.toml r=ordovicia a=ordovicia
Add a lint for wildcard dependencies in Cargo.toml.
How should I write a test for this lint?
Fixes #3347
Co-authored-by: Hidehito Yabuuchi <hdht.ybuc@gmail.com>
2018-10-24 12:21:19 +00:00
Hidehito Yabuuchi
99b78f0650
Replace remaining krate.span
with DUMMY_SP
2018-10-24 21:15:27 +09:00
Hidehito Yabuuchi
0d577c36a9
Use DUMMY_SP in multiple_crate_versions
2018-10-24 20:22:38 +09:00
Hidehito Yabuuchi
663f2cff7e
Some fixes for wildcard_dependencies
2018-10-24 20:19:13 +09:00
bors[bot]
03f8899fa5
Merge #3350
...
3350: Don't emit `new_without_default_derive` if an impl of Default exists regardless of generics r=oli-obk a=pengowen123
Fixes #2226
Co-authored-by: Owen Sanchez <pengowen816@gmail.com>
2018-10-24 07:59:06 +00:00
Hidehito Yabuuchi
fa6c9f838c
Minor changes on clippy_lints/src/wildcard_dependencies.rs
2018-10-24 15:00:28 +09:00
Hidehito Yabuuchi
0263ddde92
Lint for wildcard dependencies in Cargo.toml
2018-10-24 15:00:28 +09:00
bors[bot]
122da1de3b
Merge #3339
...
3339: Check for known array length in `needless_range_loop` r=phansch a=HMPerson1
In `VarVisitor`, we now keep track of the type of the thing that was directly indexed and, if it's an array, check if the range's end is (or is past) the array's length.
Fixes #3033
Co-authored-by: HMPerson1 <hmperson1@gmail.com>
2018-10-24 05:45:02 +00:00
Owen Sanchez
50b9e7aebc
Don't emit new_without_default_derive
if an impl of Default exists
2018-10-23 20:44:31 -07:00
Maxwell Anderson
b1abc81a60
small fix
2018-10-23 16:35:09 -06:00
Maxwell Anderson
6a695ffb3d
added float support for mistyped literal lints
2018-10-23 15:54:27 -06:00
Maxwell Anderson
83ca8d4984
Merge remote-tracking branch 'upstream/master'
2018-10-23 15:24:05 -06:00
Guillem Nieto
fd3651a551
Fix inspector pass documentation
...
When using `#[clippy_dump]`, the compiler complains about an unknown
attribute. The correct one seems to be `#[clippy::dump]`.
2018-10-23 23:03:23 +02:00
Josh Mcguigan
a624583557
new_ret_no_self added test cases
2018-10-20 06:29:17 -07:00
Josh Mcguigan
079f9f45b5
new_ret_no_self walk return type to check for self
2018-10-19 17:54:25 -07:00
HMPerson1
2e9172aea2
Check for known array length in needless_range_loop
2018-10-19 16:34:16 -04:00
HMPerson1
2a9dec681f
Fix suggestion for multiple derefs
2018-10-19 14:51:25 -04:00
Josh Mcguigan
097df8f223
new_ret_no_self correct false positive on raw pointer return types
2018-10-19 05:20:33 -07:00
Josh Mcguigan
6e75050be0
new_ret_no_self correct linting of tuple return types
2018-10-19 04:55:06 -07:00
HMPerson1
a2be050965
Fix clone_on_copy
not detecting derefs sometimes
2018-10-19 00:03:56 -04:00
Maxwell Anderson
9f637288cf
Merge remote-tracking branch 'upstream/master'
2018-10-18 15:45:05 -06:00
Matthias Krüger
fd2f6dd382
new_ret_no_self: add sample from #3313 to Known Problems section.
...
fix trivial typo on the way
2018-10-18 23:37:43 +02:00
Philipp Hansch
8f5a2484a0
Merge pull request #3303 from shssoichiro/3069-unnecessary-fold-pattern-guard
...
Note known false positives in unnecessary_fold lint
2018-10-18 22:26:33 +02:00
Lukas Stevens
5614dcb4ea
Support multiline comments and hopefully fix panic
2018-10-18 18:57:16 +02:00
Lukas Stevens
8753e568bf
Check for comments in collapsible ifs
2018-10-18 18:00:21 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
1264bb6b7d
Merge pull request #3323 from pengowen123/fix_manual_memcpy
...
Simplify manual_memcpy suggestion in some cases
2018-10-18 09:44:24 +02:00
Philipp Hansch
adbaa85ee9
Merge pull request #3330 from shssoichiro/3309-goblin-ice
...
Resolve ICE in needless range loop lint
2018-10-17 21:01:15 +02:00
Joshua Holmer
4b68c965fe
Resolve ICE in needless range loop lint
...
An ICE would occur if the needless range loop was triggered
within a procedural macro, because Clippy would try to produce
a code suggestion which was invalid, and caused the compiler
to crash.
This commit takes the same approach which Clippy currently takes
to work around this type of crash in the needless pass by value lint,
which is to skip the lint if Clippy is inside of a macro.
2018-10-17 10:43:32 -04:00
Philipp Hansch
284c63e84d
Merge pull request #3281 from CYBAI/redundant-match
...
Add lint for redundant pattern matching for explicit return boolean
2018-10-17 07:31:09 +02:00
CYBAI
66ae3b1249
Rename if_let_redundant_pattern_matching to redundant_pattern_matching
...
Also, making the old one deprecated
2018-10-17 11:20:42 +08:00
CYBAI
3b7c88888b
Add lint for redundant pattern matching for explicit return boolean
2018-10-17 11:14:37 +08:00
Giorgio Gambino
aa88e68902
Fix issue #3322 : reword help message for len_zero
2018-10-16 23:23:31 +02:00
Owen Sanchez
8c902d1cf2
Simplify manual_memcpy suggestion in some cases
2018-10-16 12:38:23 -07:00
Joshua Holmer
33847b579e
Update known problems for unnecessary_fold
2018-10-16 09:04:02 -04:00
Bruno Kirschner
2d8b4f3d5c
Avoid linting boxed_local
on trait implementations.
2018-10-15 20:34:45 +02:00
Josh Mcguigan
66d3672b26
out_of_bounds_indexing improved reporting of out of bounds value
2018-10-15 04:44:39 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
0f4b13bc1b
Merge pull request #3316 from pengowen123/fix_needless_range_loop
...
Swap order of methods in `needless_range_loop` suggestion for efficiency in some cases
2018-10-15 09:33:21 +02:00
Owen Sanchez
456843f1cd
Swap order of methods in needless_range_loop
suggestion in some cases
2018-10-14 20:14:16 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
212a4fe4f4
fix for rustc master
2018-10-14 22:55:26 +02:00
Josh Mcguigan
5c39282826
out_of_bounds_indexing refactoring
2018-10-14 07:49:28 -07:00
Matthias Krüger
c492818110
mem_forget: fix syntax error in code sample
2018-10-14 10:30:04 +02:00
Josh Mcguigan
0f3345e8b2
OUT_OF_BOUNDS_INDEXING fix #3102 false negative
2018-10-13 13:51:53 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
601cc9d2c5
Merge pull request #3310 from JoshMcguigan/explicit_counter_loop-3308
...
explicit_counter_loop fix #3308 false positive
2018-10-13 20:11:50 +02:00
Josh Mcguigan
c6f79c7ba0
explicit_counter_loop fix #3308 false positive
2018-10-13 06:57:52 -07:00
Josh Mcguigan
54506705ce
Added new_ret_no_self exception to clippy to pass dogfood tests
2018-10-13 06:25:10 -07:00
Josh Mcguigan
a5e4805ecf
new_ret_no_self correctly lint impl return
2018-10-13 06:20:39 -07:00
Josh Mcguigan
2ef4af7db2
Removed unused variables
2018-10-13 06:20:39 -07:00
Josh Mcguigan
1c4fa419f3
new_ret_no_self fix false positive for impl trait return with associated type self
2018-10-13 06:20:39 -07:00
Josh Mcguigan
13ce96c4bf
new_ret_no_self corrected panic and added test stderr
2018-10-13 06:20:39 -07:00
Josh Mcguigan
eb854b233c
new_ret_no_self added positive test cases
2018-10-13 06:20:39 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
8b12eee112
Merge pull request #3233 from rust-lang-nursery/unused-unit
...
new lint: unused_unit
2018-10-13 09:30:19 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
78860a71d8
Merge pull request #3298 from devonhollowood/pedantic-dogfood-naming
...
Pedantic dogfood: naming and docs
2018-10-13 09:24:55 +02:00
Devon Hollowood
335bc1e820
Fix some more stutter
warnings
2018-10-12 17:07:48 -07:00
Andre Bogus
e8687a6677
unused unit lint
2018-10-13 00:42:55 +02:00
Joshua Holmer
863c8e26fc
Revert "Exclude pattern guards from unnecessary_fold lint"
...
This reverts commit d3c06f7252
.
2018-10-12 13:15:55 -04:00
Joshua Holmer
d3c06f7252
Exclude pattern guards from unnecessary_fold lint
...
Methods like `Iterator::any` borrow the iterator mutably,
which is not allowed within a pattern guard and will fail to compile.
This commit prevents clippy from suggesting this type of change.
Closes #3069
2018-10-12 12:11:56 -04:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
d445dbfe16
Merge pull request #3291 from JoshMcguigan/cmp_owned-3289
...
cmp_owned wording and false positive
2018-10-12 15:07:12 +02:00
Josh Mcguigan
352863065c
cmp_owned refactor
2018-10-12 04:48:54 -07:00
Josh Mcguigan
c9718fa589
cmp_owned correct error message if rhs is deref
2018-10-12 04:34:41 -07:00
sigustin
4e20625187
Add a comment reminding to update README if the default changes
2018-10-12 12:32:48 +02:00
Maxwell Anderson
63fbeaab68
Merge remote-tracking branch 'upstream/master'
2018-10-11 22:16:05 -06:00
Maxwell Anderson
9fad38dca9
tmp progress
2018-10-11 22:15:01 -06:00
Devon Hollowood
73ba33dd2b
Fix doc_markdown
lints
2018-10-11 15:43:13 -07:00
Devon Hollowood
dcef9d0795
Fix stutter
lints
2018-10-11 15:42:22 -07:00
Devon Hollowood
9afd8abbe3
Fix similar_names
warnings
...
Most of these are just `#![allow]`ed, because they are things like using
l vs r to differentiate left vs right. These would be made less clear by
taking the advice of `similar_names`
2018-10-11 15:18:58 -07:00
Josh Mcguigan
0b65462ca5
cmp_owned current suggestion for multiple deref
2018-10-11 05:03:02 -07:00
Oliver Scherer
9d3373137b
Remove now-useless allow(unknown_lints)
2018-10-11 12:18:27 +02:00
Oliver Scherer
b8654eaa6c
Stabilize tool lints
2018-10-11 12:16:22 +02:00
Philipp Hansch
8b45dd704b
Merge pull request #3294 from mikerite/fix-3276
...
Fix fn_to_numeric_cast_with_truncation suppression
2018-10-11 10:53:05 +02:00
Philipp Hansch
928a6d3dc7
Merge pull request #3288 from devonhollowood/pedantic-dogfood-casts
...
Pedantic dogfood: casts
2018-10-11 08:07:51 +02:00
Michael Wright
80cf0d7f26
Fix fn_to_numeric_cast_with_truncation suppression
...
Fixes #3276
2018-10-11 07:45:26 +02:00
mikerite
31eb3b73d3
Merge pull request #3127 from mikerite/fix-2937
...
Fix 2937
2018-10-11 06:22:02 +02:00
Karim SENHAJI
f9e4f5695d
Limit commutative assign op lint to primitive types
2018-10-10 19:10:44 +02:00
Devon Hollowood
289c642d1a
Clarify code
...
Take advantage of the fact that very large regexes are unlikely
2018-10-09 23:35:10 -07:00
Michael Wright
7499cb543d
Fix #2937
2018-10-10 07:52:58 +02:00
Josh Mcguigan
88ee209a1d
Corrected single-character string constant used as pattern found in dogfood test
2018-10-09 20:01:12 -07:00
Josh Mcguigan
b0d7aea946
Fixes 3289, cmp_owned wording and false positive
2018-10-09 19:25:03 -07:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
f6882ede4d
Merge pull request #3287 from JoshMcguigan/cmp_owned-2925
...
cmp_owned false positive
2018-10-09 10:01:31 +02:00
Devon Hollowood
2b9abc5daa
Fix cast_possible_wrap and cast_sign_loss warnings
2018-10-08 22:34:10 -07:00
Devon Hollowood
eef2e8948b
Fix cast_possible_truncation warnings
2018-10-08 21:40:21 -07:00
Josh Mcguigan
ad5c29a445
Fixes #2925 cmp_owned false positive
2018-10-08 19:04:29 -07:00
Matthias Krüger
a578cb2d62
if_let_redundant_pattern_matching: use Span.to() instead of Span.with_hi() to fix crash.
...
Fixes #3064
2018-10-08 17:34:43 +02:00
Rotem Yaari
1ef32e4096
Improve diagnostics in case of lifetime elision ( closes #3284 )
2018-10-08 13:07:21 +03:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
02705d4cf5
Merge pull request #3282 from JoshMcguigan/excessive_precision-2840
...
Fix excessive_precision false positive
2018-10-08 08:24:13 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
ce2da2c04f
Merge pull request #3283 from etaoins/dont-suggest-cloned-for-map-box-deref
...
Don't suggest cloned() for map Box deref
2018-10-08 08:21:59 +02:00
Philipp Hansch
41e94dd072
Merge pull request #3285 from devonhollowood/pedantic-dogfood-items-after-statements
...
Pedantic dogfood: `items_after_statements`
2018-10-08 06:59:55 +01:00
Devon Hollowood
82638e4dd4
Fix items_after_statements for const
s
2018-10-07 17:09:32 -07:00
Devon Hollowood
be983fbf52
Fix items_after_statements for sub-functions
2018-10-07 17:09:32 -07:00
Devon Hollowood
6528749083
Fix items_after_statements for use
statements
2018-10-07 17:09:32 -07:00
Ryan Cumming
9bd4e5469e
Don't suggest cloned() for map Box deref
...
Boxes are a bit magic in that they need to use `*` to get an owned value
out of the box. They implement `Deref` but that only returns a
reference. This means an easy way to convert an `Option<Box<T>>` to an
`<Option<T>` is:
```
box_option.map(|b| *b)
```
However, since b36bb0a6
the `map_clone` lint is detecting this as an
attempt to copy the box. Fix by excluding boxes completely from the
deref part of this lint.
Fixes #3274
2018-10-08 06:20:32 +11:00
Josh Mcguigan
8a77a25b8a
Fix excessive_precision false positive
2018-10-07 11:38:20 -07:00
Philipp Hansch
63ceabf0cf
Merge pull request #3280 from d-dorazio/fix-new_without_default-should-not-fire-unsafe-new
...
new_without_default should not warn about unsafe new
2018-10-07 13:09:37 +01:00
Manish Goregaokar
5dcb90e29d
Merge pull request #3279 from phansch/fix_fp_in_fn_to_numeric_cast_with_truncation
...
Fix FP in `fn_to_numeric_cast_with_truncation`
2018-10-07 04:27:51 -07:00
Philipp Hansch
d365742bc6
Fix FP in fn_to_numeric_cast_with_truncation
...
We only want this lint to check casts to numeric, as per the lint title.
Rust already has a built-in check for all other casts
[here][rust_check].
[rust_check]: 5472b0718f/src/librustc_typeck/check/cast.rs (L430-L433)
2018-10-07 12:50:36 +02:00
Daniele D'Orazio
59c4ff77f1
new_without_default should not warn about unsafe new
2018-10-07 12:39:54 +02:00
Dylan Maccora
d129d049c6
Adding more detail to filter_map lint documentation.
2018-10-07 11:24:09 +11:00
Manish Goregaokar
e9c025ea70
Add license header to Rust files
2018-10-06 09:43:08 -07:00
Manish Goregaokar
53d41e5c50
Rustup for https://github.com/rust-lang/rust/pull/54741
2018-10-05 13:41:40 -07:00
Manish Goregaokar
cbde8201c5
Remove unused utils
2018-10-05 13:26:39 -07:00
Manish Goregaokar
75965030c7
Merge pull request #3251 from rust-lang-nursery/relicense-rewrite
...
[do not merge] Relicensing rewrite
2018-10-05 20:14:55 +02:00
Philipp Hansch
1544a1a681
Merge remote-tracking branch 'origin/master' into relicense-rewrite
2018-10-05 07:18:24 +02:00
Joel Gallant
163780ee0b
Solves #3222 by checking the BareFnTy Abi type
2018-10-04 18:49:03 -06:00
Philipp Hansch
391d53db66
Add hidden lifetime parameters to fix warning
2018-10-04 21:59:30 +02:00
Philipp Hansch
c0ab8b2531
Reimplement the fn_to_numeric_cast_with_truncation
lint
2018-10-04 21:44:16 +02:00
Philipp Hansch
7adf24ebb0
Improve docs of fn_to_numeric_cast
...
Closes #2980
2018-10-04 18:09:09 +02:00
Matthias Krüger
fd5ea0ddf7
resolve build warnings in clippy_lints/src/format.rs
2018-10-04 16:34:41 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
c3e3be374b
Merge pull request #3256 from rust-lang-nursery/fix-2796
...
Fix 2796 and 3020
2018-10-04 08:51:00 +02:00
mcarton
5173ed0c03
Don't suggest to_string().to_string
in USELESS_FORMAT
2018-10-03 20:59:59 +02:00
Philipp Hansch
f42272102a
Reimplement the fn_to_numeric_cast
lint
2018-10-03 12:02:06 +02:00
Manish Goregaokar
c430147942
Fix push_item_path call (rustup to 4cf11765dc98536c6eedf33f2df7f72f6e161263)
2018-10-03 02:06:26 -07:00
mcarton
7eebd5b20c
Ignore format!
with precision in USELESS_FORMAT
2018-10-02 23:57:22 +02:00
Oliver Schneider
913a5c9b56
Trailing newline
2018-10-02 15:18:56 +02:00
Oliver Schneider
696dc369df
FIx dogfood
2018-10-02 15:17:56 +02:00
Oliver Schneider
b36bb0a68d
Reimplement the map_clone
lint from scratch
2018-10-02 15:13:43 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer
11cc8472a9
Merge pull request #3245 from JoshMcguigan/wrong_self_convention-1530
...
Correct false positive in wrong_self_convention lint for to_mut
2018-10-02 14:54:36 +02:00
Josh Mcguigan
f142098474
Correct false positive in wrong_self_convention lint for to_mut
2018-10-02 04:47:38 -07:00
Manish Goregaokar
057243f16b
relicensing: Remove map_clone
...
This removes the code added in https://github.com/rust-lang-nursery/rust-clippy/pull/427
2018-10-02 12:51:38 +02:00
Manish Goregaokar
fffcd093b2
relicensing: Remove fn_to_numeric_cast, fn_to_numeric_cast_with_truncation
...
This removes the code added in https://github.com/rust-lang-nursery/rust-clippy/pull/2814
2018-10-02 12:49:27 +02:00
Manish Goregaokar
be1094bd8d
ScalarMaybeUndef -> Scalar (Rustup to e812ca472a2a5284e9f15cd9af32285d7ff3fd39)
2018-10-02 10:35:26 +02:00
Philipp Hansch
eb5f146f14
Fix 'impossible case reached' ICE
2018-10-01 22:34:52 +02:00
Matthias Krüger
91f7e22edf
remove cargo edition 2018 feature gate.
...
Rust and the cargo used to bootstrap was updated in https://github.com/rust-lang/rust/pull/54601 which now has the 2018 edition stabilized.
2018-09-30 11:12:24 +02:00
Michael Wright
50133fbd3a
Merge branch 'master' into unnecessary_filter_map
2018-09-30 06:39:56 +02:00
Josh Mcguigan
e25f884e6f
Fixes #3180 , suppress excessive_precision lint for floats with no decimal part
2018-09-29 07:39:30 -07:00
Michael Wright
c2ee9c29ab
Merge branch 'master' into unnecessary_filter_map
2018-09-29 15:27:47 +02:00
Michael Wright
06f6b36025
rustfmt
2018-09-29 14:18:50 +02:00
Michael Wright
efdc739dfc
Move unnecessary_filter_map to a submodule
2018-09-29 14:12:40 +02:00
Philipp Krones
67d85bc47d
Merge pull request #3224 from matthiaskrgr/clippy_self__use_self
...
fix some clippy::pedantic warnings found in the codebase.
2018-09-28 15:26:50 +02:00
Philipp Hansch
8e808664fa
Merge pull request #3178 from ms2300/bad_unwrap
...
Fix for bad get unwrap suggestion
2018-09-28 07:38:00 +01:00
Michael Wright
4b4d758ce0
Fix warnings in clippy_lints
2018-09-27 06:29:48 +02:00
Michael Wright
2f364d9ac5
Merge branch 'master' into unnecessary_filter_map
2018-09-27 06:12:01 +02:00
Matthias Krüger
9fae4693f9
fix clippy::single-match-else and clippy::match_same_arms warnings in clippys codebase
2018-09-26 22:25:01 +02:00
Matthias Krüger
2a31937cc9
fix all clippy::use_self pedantic warnings found in the codebase.
...
cc #3172
2018-09-26 22:24:18 +02:00
Matthias Krüger
fc35c20a0a
rustup
...
fix breakage by https://github.com/rust-lang/rust/pull/53824
use smallvec crate instead of rustcs type alias.
2018-09-26 15:57:38 +02:00
Michael Wright
f5ffac4fce
Implement unnecesary_filter_map lint
2018-09-26 06:52:36 +02:00
Jane Lusby
14feb3670f
Lint for chaining flatten after map
...
This change adds a lint to check for instances of `map(..).flatten()`
that can be trivially shortened to `flat_map(..)`
Closes #3196
2018-09-24 14:29:16 -07:00
Michael Wright
ab71f08663
Fix single_char_pattern crash ( #3204 )
...
This commit fixes the crash by removing constant checking from the lint.
Closes #3204 .
2018-09-24 08:33:57 +02:00
ms2300
523ba2a009
Full fix of get unwrap issue
2018-09-23 19:53:25 -07:00
ms2300
de8d233b06
#3006 : Fixing for .get().unwrap().foo()
2018-09-23 19:53:25 -07:00
Philipp Krones
bc6d85ceaf
Merge pull request #3207 from mikerite/fix-3206
...
Fix double_parens false positive
2018-09-23 18:24:27 +02:00
Philipp Krones
af2d6a0c14
Merge pull request #3191 from vi/suggest_with_applicability
...
Use span_suggestion_with_applicability instead of span_suggestion
2018-09-23 15:45:55 +02:00
Michael Wright
867ac98d38
Fix double_parens false positive
...
Closes #3206
2018-09-22 17:20:34 +02:00
flip1995
987b34d090
Another Applicability adjustment
2018-09-20 14:38:48 +02:00
Vitaly _Vi Shukela
52fb7d461e
Applicability adjustment per additional comments
2018-09-20 14:38:48 +02:00
Vitaly _Vi Shukela
58729346be
Fill in Applicability from review comments by @flip1995
2018-09-20 14:38:48 +02:00
Vitaly _Vi Shukela
3eccccb367
Fix indents
2018-09-20 14:38:48 +02:00
Vitaly _Vi Shukela
2781cac839
Apply subset of "cargo fmt".
2018-09-20 14:38:47 +02:00
Vitaly _Vi Shukela
3e853a632e
Add forgotten function: span_suggestion*s* to the previous refactoting
2018-09-20 14:38:47 +02:00
Vitaly _Vi Shukela
d4c994e670
Supplement DiagnosticBuilderExt with Applicability
2018-09-20 14:38:47 +02:00
Vitaly _Vi Shukela
92034e20c8
Use span_suggestion_with_applicability instead of span_suggestion
2018-09-20 14:38:47 +02:00
Jay Kickliter
79cda3bb1e
mem_replace: fix grammar.
2018-09-19 14:54:38 -07:00
Jay Kickliter
2f53aaa5bd
mem_replace: match on path.
2018-09-19 14:41:22 -07:00
Jay Kickliter
12c7bc1e58
mem_replace: apply update_lints tool.
2018-09-19 14:41:22 -07:00
Jay Kickliter
1b6d739ce3
mem_replace: make examples compilable.
2018-09-19 14:38:34 -07:00
Jay Kickliter
598df08d88
Add lint for mem::replace(.., None)
.
...
Suggest `Option::take()` as an alternative.
2018-09-19 14:38:34 -07:00
Philipp Hansch
b6707ffc42
Merge pull request #3187 from flip1995/internal_fn
...
New internal lint: compiler_lint_functions
2018-09-19 19:43:48 +01:00
flip1995
a8b681cc2c
Fix c_void path
...
This got changed in rust-lang/rust#53910
2018-09-17 11:20:27 +02:00
Michael Wright
c78cf042ff
Remove unneeded check for method call
...
The check can be removed because the call to `method_chains_args`
already performs this check.
2018-09-16 13:08:00 +02:00
flip1995
021748eb6a
Replace another occurrence of "".to_owned()
2018-09-15 11:25:40 +02:00
Matthias Krüger
f3add4acb4
convert "".to_string() and "".to_owned() to String::new()
2018-09-15 11:20:35 +02:00
flip1995
144281c537
Formatting
2018-09-15 11:02:00 +02:00
flip1995
a4e1a90705
Fix warnings of compiler_lint_functions
2018-09-15 11:02:00 +02:00
flip1995
aaeeaa5330
Add internal lint compiler_lint_functions
2018-09-15 11:01:16 +02:00
Eduard-Mihai Burtescu
c70bfb2cac
Revert "the cargo feature: edition 2018 is stabilized in current nightly"
...
This reverts commit 404a09d61c
.
2018-09-15 11:16:45 +03:00
Eduard-Mihai Burtescu
85caaf5905
Fix useless_attribute
to also whitelist unused_extern_crates
.
2018-09-15 11:16:45 +03:00
Eduard-Mihai Burtescu
9219fc6c5c
Reintroduce extern crate
for non-Cargo dependencies.
2018-09-15 11:10:51 +03:00
Philipp Hansch
4aaef72fa0
Merge pull request #3186 from flip1995/pedantic_filter_map
...
Fix pedantic filter_map warnings
2018-09-14 19:47:50 +01:00
flip1995
582ab5a0d0
Reapply: "the cargo feature: edition 2018 is stabilized in current nightly"
...
This reapplies commit 404a09d
.
Cargo got bumped in rust-lang/rust#54210
2018-09-14 13:43:20 +02:00
flip1995
f49f133cba
Fix pedantic filter_map warnings
2018-09-14 12:56:25 +02:00
Manish Goregaokar
7b530c79b2
Add match on StructCtor
2018-09-14 12:41:20 +05:30
Philipp Hansch
dac5e2d3a5
Merge pull request #3140 from matthiaskrgr/redundant_casts
...
fix warnings about trivial casts, mostly {i,u}128 -> {i,u}128, such as "i128::min_value() as i128"
2018-09-13 20:37:13 +01:00
Philipp Hansch
07cb45bc85
Merge pull request #3166 from flip1995/travis_internal
...
Run internal lints on the Clippy code base
2018-09-13 17:22:48 +01:00
Matthias Krüger
28424ecbfa
fix warnings about trivial casts, mostly {i,u}128 -> {i,u}128, such as "i128::min_value() as i128"
2018-09-13 07:59:12 +02:00
Philipp Hansch
e8400061bd
Merge pull request #3085 from mikerite/revert-98dbce
...
Revert "Fix E0502 warnings"
2018-09-13 06:33:26 +01:00
Boyu Yang
4827ab978e
Remove a wrong suggestion.
2018-09-13 13:01:23 +08:00
Boyu Yang
60e8da1647
Fix typo in examples.
2018-09-13 11:51:58 +08:00
flip1995
e28440d2e0
Change Hash{Map, Set} to FxHash{Map, Set}
2018-09-12 01:34:52 +02:00