| Age | Commit message (Collapse) | Author | Lines |
|
This lint prevents using a wildcard in a match.
|
|
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
|
|
|
|
* `const_transmute` currently also seems to depend on the `const_fn`
feature.
* Only `Sized` is currently allowed as a bound, not Copy.
|
|
|
|
|
|
|
|
|
|
|
|
Ignore arguments with the question mark operator.
Closes #2945
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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]`.
|
|
|
|
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
|
|
Change the recommended solution from `vec![len; 0]` to `vec![0; len]`.
Also fix grammar.
|
|
|
|
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
|
|
`::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.
|
|
|
|
Closes https://github.com/rust-lang/rust-clippy/issues/3692.
|
|
Due to https://github.com/rust-lang/rust/pull/51285
|
|
This commit corrects some bad suggestions produced by the
`expect_fun_call` lint and enables `rust-fix` checking on the tests.
Addresses #3630
|
|
|
|
* 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
...
|
|
"make_return" and "blockify" convenience methods, fixes #3683
…ed them in "needless_bool".
|
|
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
|
|
|
|
|
|
|
|
|
|
Co-Authored-By: daxpedda <1645124+daxpedda@users.noreply.github.com>
|
|
in "needless_bool".
|
|
Remove negative integer literal checks.
Fixes #3678.
|
|
|
|
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!()`
|
|
|
|
needless bool lint suggestion is wrapped in brackets if it is an "els…
…e" clause of an "if-else" statement
|
|
|
|
Co-Authored-By: g-bartoszek <grzegorz.bartoszek@thaumatec.com>
|
|
|
|
|
|
clause of an "if-else" statement
|
|
|
|
|