about summary refs log tree commit diff
path: root/clippy_lints/src
AgeCommit message (Collapse)AuthorLines
2019-01-29Add match_wild lint (#3649).Alex Hamilton-1/+38
This lint prevents using a wildcard in a match.
2019-01-29Auto merge of #3648 - phansch:const_fn_lint, r=oli-obkbors-1/+135
Add initial version of const_fn lint This adds an initial version of a lint that can tell if a function could be `const`. TODO: - [x] Finish up the docs - [x] Fix the ICE cc #2440
2019-01-29cargo fmtPhilipp Hansch-4/+3
2019-01-29Update various docsPhilipp Hansch-3/+3
* `const_transmute` currently also seems to depend on the `const_fn` feature. * Only `Sized` is currently allowed as a bound, not Copy.
2019-01-29Use built-in entry_fn detection over self-builtPhilipp Hansch-29/+21
2019-01-29cargo fmtPhilipp Hansch-21/+23
2019-01-29Reorganize conditionals: Run faster checks firstPhilipp Hansch-17/+23
2019-01-29Maybe fix ICE?Philipp Hansch-1/+3
2019-01-29Add initial version of const_fn lintPhilipp Hansch-0/+133
2019-01-29Fix `unit_arg` false positiveMichael Wright-24/+31
Ignore arguments with the question mark operator. Closes #2945
2019-01-28Auto merge of #3700 - phansch:would_you_like_some_help_with_this_const_fn, ↵bors-0/+4
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-28RustfmtOliver Scherer-1/+1
2019-01-28Check hypothetically failing conversionOliver Scherer-1/+2
2019-01-28Update more changed iterator pathsOliver Scherer-1/+1
2019-01-28Atomics constants are now handled by the deprecation lintOliver Scherer-15/+0
2019-01-28Update changed iterator pathsOliver Scherer-1/+1
2019-01-28Update const slice processingOliver Scherer-1/+1
2019-01-27Auto merge of #3706 - robamler:patch-1, r=phanschbors-2/+2
Fix documentation for `slow_vector_initialization` This PR fixes the documentation for the lint `slow_vector_initialization`. The documentation recommended writing `vec![len; 0]` but the correct solution is `vec![0; len]`.
2019-01-27run cargo fmtMatthias Krüger-18/+3
2019-01-27rustup https://github.com/rust-lang/rust/pull/57907/Matthias Krüger-88/+88
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-26Fix documentation for `slow_vector_initialization`Robert Bamler-2/+2
Change the recommended solution from `vec![len; 0]` to `vec![0; len]`. Also fix grammar.
2019-01-27rustup https://github.com/rust-lang/rust/pull/57726Matthias Krüger-3/+583
2019-01-26Auto merge of #3690 - mikerite:fix-3630-expect-fun-call, r=phanschbors-90/+99
Fix `expect_fun_call` lint suggestions This commit corrects some bad suggestions produced by the `expect_fun_call` lint and enables `rust-fix` checking on the tests. Addresses #3630
2019-01-26Prevent incorrect cast_lossless suggestion in const_fnPhilipp Hansch-0/+4
`::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-26Incorporate review suggestionsMichael Wright-35/+44
2019-01-25chore(cargo/dependencies/cargo-metadata): Upgrade to 0.7.1Sorin Davidoi-3/+3
Closes https://github.com/rust-lang/rust-clippy/issues/3692.
2019-01-24RustupPhilipp Hansch-1/+1
Due to https://github.com/rust-lang/rust/pull/51285
2019-01-24Fix `expect_fun_call` lint suggestionsMichael Wright-93/+93
This commit corrects some bad suggestions produced by the `expect_fun_call` lint and enables `rust-fix` checking on the tests. Addresses #3630
2019-01-23allow assertions_on_constants for collapsible_if and missing_test_filesA.A.Abroskin-9/+0
2019-01-23Merge branch 'master' into add-lints-aseert-checksA.A.Abroskin-1582/+380
* master: (58 commits) Rustfmt all the things Don't make decisions on values that don't represent the decision Improving comments. Rustup Added rustfix to the test. Improve span shortening. Added "make_return" and "blockify" convenience methods in Sugg and used them in "needless_bool". Actually check for constants. Fixed potential mistakes with nesting. Added tests. formatting fix Update clippy_lints/src/needless_bool.rs formatting fix Fixing typo in CONTRIBUTING.md Fix breakage due to rust-lang/rust#57651 needless bool lint suggestion is wrapped in brackets if it is an "else" clause of an "if-else" statement Fix automatic suggestion on `use_self`. Remove negative integer literal checks. Fix `implicit_return` false positives. Run rustfmt Fixed breakage due to rust-lang/rust#57489 ...
2019-01-22Auto merge of #3684 - g-bartoszek:sugg-snippet-modifications, r=phanschbors-8/+35
"make_return" and "blockify" convenience methods, fixes #3683 …ed them in "needless_bool".
2019-01-22Auto merge of #3679 - daxpedda:use_self, r=phanschbors-1/+6
Fix automatic suggestion on `use_self`. In an example like this: ```rust impl Example { fn fun_1() { } fn fun_2() { Example::fun_1(); } } ``` Clippy tries to replace `Example::fun_1` with `Self`, loosing `::fun_1` in the process, it should rather try to replace `Example` with `Self`. **Question** - There may be other paths that need the same treatment, but I'm not sure I understand them fully: - https://github.com/rust-lang/rust-clippy/blob/e648adf0866a1cea7db6ce2d33ea86e442f25377/clippy_lints/src/use_self.rs#L94-L96 - https://github.com/rust-lang/rust-clippy/blob/e648adf0866a1cea7db6ce2d33ea86e442f25377/clippy_lints/src/use_self.rs#L225-L229
2019-01-22Rustfmt all the thingsOliver Scherer-5/+16
2019-01-22Don't make decisions on values that don't represent the decisionOliver Scherer-3/+8
2019-01-22Improving comments.daxpedda-2/+1
2019-01-22RustupOliver Scherer-2/+2
2019-01-22Improve span shortening.Philipp Krones-1/+1
Co-Authored-By: daxpedda <1645124+daxpedda@users.noreply.github.com>
2019-01-22Added "make_return" and "blockify" convenience methods in Sugg and used them ↵Grzegorz Bartoszek-8/+35
in "needless_bool".
2019-01-21Auto merge of #3677 - daxpedda:integer_arithmetic, r=oli-obkbors-2/+5
Remove negative integer literal checks. Fixes #3678.
2019-01-21Actually check for constants.daxpedda-1/+8
2019-01-21Auto merge of #3676 - daxpedda:implicit_return, r=oli-obkbors-6/+22
Fix `implicit_return` false positives. Fixes the following false positives: - linting on `if let` without `else` in a `loop` even with a present `return` - linting on `unreachable!()`
2019-01-21Fixed potential mistakes with nesting. Added tests.daxpedda-5/+11
2019-01-21Auto merge of #3680 - g-bartoszek:needless-bool-else-if-brackets, r=oli-obkbors-1/+18
needless bool lint suggestion is wrapped in brackets if it is an "els… …e" clause of an "if-else" statement
2019-01-21formatting fixGrzegorz Bartoszek-1/+0
2019-01-21Update clippy_lints/src/needless_bool.rsOliver Scherer-1/+1
Co-Authored-By: g-bartoszek <grzegorz.bartoszek@thaumatec.com>
2019-01-21formatting fixGrzegorz Bartoszek-1/+1
2019-01-20Fix breakage due to rust-lang/rust#57651Michael Wright-0/+8
2019-01-20needless bool lint suggestion is wrapped in brackets if it is an "else" ↵Grzegorz Bartoszek-1/+19
clause of an "if-else" statement
2019-01-20Fix automatic suggestion on `use_self`.daxpedda-6/+6
2019-01-20Remove negative integer literal checks.daxpedda-5/+1