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