flip1995
a0e9f9bd0d
Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2
2020-05-28 15:45:24 +02:00
Bastian Kauschke
091239ee60
introduce newtype'd Predicate<'tcx>
2020-05-20 15:44:34 +02:00
Bastian Kauschke
2722522fac
rename Predicate
to PredicateKind
, introduce alias
2020-05-20 15:38:03 +02:00
flip1995
f1d3086492
Merge commit 'e214ea82ad0a751563acf67e1cd9279cf302db3a' into clippyup
2020-05-17 17:36:26 +02:00
CrazyRoka
20c069beec
Fixed incorrect suggestion of clone_double_ref
lint
...
- Added `<_>` to suggestion
- Changed help message
2020-04-29 22:40:57 +03:00
Philipp Hansch
0a49935270
cargo dev fmt
2020-04-26 13:44:08 +02:00
Philipp Hansch
0480ff861a
More diagnostic items
...
In particular for:
* `VecDeque`
* `String`
* `Mutex`
* `HashMap`
* `HashSet`
cc https://github.com/rust-lang/rust/pull/71414 https://github.com/rust-lang/rust-clippy/issues/5393
2020-04-26 13:44:08 +02:00
xiongmao86
d7f1a1ed2b
Change note_span argument for span_lint_and_note.
2020-04-18 18:29:36 +08:00
xiongmao86
cf4e35339b
Add an Option<Span> argument to span_lint_and_help.
2020-04-18 18:28:29 +08:00
Philipp Hansch
870ae36f85
Cleanup: Rename 'db' variable to 'diag'
2020-04-17 08:08:00 +02:00
Marcin Serwin
c20afbdfe0
Lint map_flatten if caller is an Option
2020-04-16 08:00:32 +02:00
bors
81b3e7096b
Auto merge of #5449 - phansch:diagnostic-items, r=matthiaskrgr
...
Make use of more diagnostic items
This makes use of some (not all) already existing diagnostic items. Specifically:
* 79982a2
: `core::mem::uninitialized`, `core::mem::zeroed`, `alloc::sync::Arc`, `alloc::sync::Rc`
* 83874d0
: `Option` and `Result`
cc #5393
changelog: none
2020-04-14 19:58:17 +00:00
bors
d236b30a1d
Auto merge of #5457 - phansch:sym, r=matthiaskrgr
...
Cleanup: Use our `sym!` macro more
It's much shorter than Symbol::intern and the effect should still be clear
---
changelog: none
2020-04-14 12:30:14 +00:00
bors
54344c78f4
Auto merge of #5448 - Emerentius:update_new_ret_no_self_docs, r=phansch
...
Update documentation for new_ret_no_self
changelog: Update documentation for lint new_ret_no_self to reflect that the return type must only contain `Self`, not be `Self`
The lint was changed to be more lenient than the documentation implies in PR #3338 (Related issue #3313 )
2020-04-13 20:32:44 +00:00
Philipp Hansch
31c5664f25
Cleanup: Use our sym!
macro more
...
It's much shorter that Symbol::intern and the result should still be
clear.
2020-04-13 08:57:34 +02:00
Philipp Hansch
a524be6df5
cargo dev fmt
2020-04-12 15:23:54 +02:00
Philipp Hansch
83874d0ee7
Make use of Option/Result diagnostic items
2020-04-12 15:23:07 +02:00
Philipp Hansch
79982a2813
Make use of some existing diagnostic items
2020-04-12 13:58:04 +02:00
bors
5e8c0c5ae0
Auto merge of #5441 - rabisg0:fix/clone-on-copy, r=phansch
...
Check for clone-on-copy in argument positions
Earlier if arguments to method calls matched the above pattern they were
not reported. This patch ensures such arguments are checked as well.
Fixes #5436
changelog: apply clone_on_copy lint to func args as well
2020-04-10 21:49:26 +00:00
Emerentius
ed72dc4119
Update documentation for new_ret_no_self
...
The lint was changed to be more lenient than the documentation implies in PR #3338 .
Related issue #3313
2020-04-10 19:08:31 +02:00
Philipp Hansch
3ef1dab211
Rustup to https://github.com/rust-lang/rust/pull/70913
2020-04-10 19:03:34 +02:00
Philipp Krones
90fb50fabf
Revert "Downgrade new_ret_no_self to pedantic"
2020-04-09 19:38:20 +02:00
Rabi Guha
183c4abb22
Check for clone-on-copy in argument positions
...
Earlier if arguments to method calls matched the above pattern they were
not reported. This patch ensures such arguments are checked as well.
Fixes #5436
2020-04-09 21:59:42 +05:30
bors
940bbd6aa4
Auto merge of #5437 - rabisg0:should-impl-trait, r=flip1995
...
Check fn header along with decl when suggesting to implement trait
When checking for functions that are potential candidates for trait
implementations check the function header to make sure modifiers like
asyncness, constness and safety match before triggering the lint.
Fixes #5413 , #4290
changelog: check fn header along with decl for should_implement_trait
2020-04-08 16:55:47 +00:00
Rabi Guha
c2e5534157
Check fn header along with decl when suggesting to implement trait
...
When checking for functions that are potential candidates for trait
implementations check the function header to make sure modifiers like
asyncness, constness and safety match before triggering the lint.
Fixes #5413 , #4290
2020-04-08 21:24:20 +05:30
David Tolnay
899a1b5598
Move cognitive_complexity to nursery
2020-04-08 08:37:20 -07:00
Philipp Krones
79d152190c
Rollup merge of #5425 - xiongmao86:issue5367, r=flip1995
...
Ehance opt_as_ref_deref lint.
- [x] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Run `cargo dev fmt`
Lint on opt.as_ref().map(|x| &**x). Fixes #5367 .
changelog: lint on opt.as_ref().map(|x| &**x)
2020-04-08 15:50:28 +02:00
Philipp Krones
7cb5180dfb
Rollup merge of #5420 - dtolnay:newret, r=flip1995
...
Downgrade new_ret_no_self to pedantic
As motivated by #5418 . This is the second most widely suppressed Clippy style lint, and [this grep.app search](https://grep.app/search?q=%5C%5Ballow%5C%28.%2Aclippy%3A%3Anew_ret_no_self%5Cb®exp=true&case=true&filter[lang][0]=Rust ) shows a large number of diverse reasonable signatures for a `new` method.
changelog: Remove new_ret_no_self from default set of enabled lints
2020-04-08 15:50:24 +02:00
Philipp Krones
a1e49f962c
Rollup merge of #5415 - nickrtorres:master, r=flip1995
...
Add new lint for `Result<T, E>.map_or(None, Some(T))`
Fixes #5414
PR Checklist
---
- [x] Followed lint naming conventions (the name is a bit awkward, but it seems to conform)
- [x] Added passing UI tests (including committed .stderr file)
- [x] cargo test passes locally
- [x] Executed cargo dev update_lints
- [x] Added lint documentation
- [x] Run cargo dev fmt
`Result<T, E>` has an [`ok()`](https://doc.rust-lang.org/std/result/enum.Result.html#method.ok ) method that adapts a `Result<T,E>` into an `Option<T>`.
It's possible to get around this adapter by writing `Result<T,E>.map_or(None, Some)`.
This lint is implemented as a new variant of the existing [`option_map_none` lint](https://github.com/rust-lang/rust-clippy/pull/2128 )
2020-04-08 15:50:20 +02:00
Philipp Krones
5ea4771433
Rollup merge of #5412 - dtolnay:tostring, r=flip1995
...
Downgrade inefficient_to_string to pedantic
From the [documentation](https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string ):
> ```diff
> - ["foo", "bar"].iter().map(|s| s.to_string());
>
> + ["foo", "bar"].iter().map(|&s| s.to_string());
> ```
I feel like saving 10 nanoseconds from the formatting machinery isn't worth asking the programmer to insert extra `&` / `*` noise in the *vast* majority of cases. This is a pedantic lint.
changelog: Remove inefficient_to_string from default set of enabled lints
2020-04-08 15:50:19 +02:00
Linus Färnstrand
1647f53fb3
Use int assoc consts in MANUAL_SATURATING_ARITHMETIC
2020-04-08 00:43:27 +02:00
Eduard Burtescu
2ad4d6a057
rustup: update for the new Ty::walk interface.
2020-04-07 19:53:56 +00:00
xiongmao86
d7056f8ffb
Refine lint message.
2020-04-07 21:25:07 +08:00
xiongmao86
4f14826e09
Lint on opt.as_ref().map(|x| &**x).
2020-04-06 22:53:59 +08:00
Nick Torres
5d54fbb791
result_map_or_into_option: fix syntax error in example
2020-04-04 17:20:23 -07:00
Nick Torres
325d0b69d2
result_map_or_into: fix dogfood_clippy error => {h,l}int
2020-04-04 15:02:38 -07:00
Nick Torres
2533f56a0e
result_map_or_into_option: fix cargo dev fmt --check
errors
2020-04-04 14:33:43 -07:00
Nick Torres
acc3bc1ba2
result_map_or_into_option: move arg checks into tuple assignment
2020-04-04 14:24:22 -07:00
Nick Torres
d0738bd673
result_map_or_into_option: destructure lint tuple or return early
2020-04-04 14:16:23 -07:00
Nick Torres
3a29aedf8d
result_map_or_into_option: add good and bad examples
2020-04-04 14:16:18 -07:00
Nick Torres
91759a7582
result_map_or_into_option: explicitly note absence of known problems
2020-04-04 14:16:11 -07:00
David Tolnay
560c8c9c70
Downgrade new_ret_no_self to pedantic
2020-04-04 12:58:18 -07:00
Nick Torres
91d8a804d3
result_map_or_into_option: add lint to catch manually adpating Result -> Option
...
Result<T, E> has an `ok()` method that adapts a Result<T,E> into an Option<T>.
It's possible to get around this adapter by writing Result<T,E>.map_or(None, Some).
This lint is implemented as a new variant of the existing
[`option_map_none` lint](https://github.com/rust-lang/rust-clippy/pull/2128 )
2020-04-04 03:17:13 -07:00
David Tolnay
e26ae7a0ff
Downgrade inefficient_to_string to pedantic
2020-04-02 20:00:12 -07:00
Matthias Krüger
aff57e0f43
rustup https://github.com/rust-lang/rust/pull/70536
2020-03-30 11:17:58 +02:00
Philipp Hansch
cec1e8f74e
Remove dependency on matches
crate
...
The std equivalent works exactly the same.
2020-03-25 07:50:08 +01:00
Matthias Krüger
a97f60b8e3
rustup https://github.com/rust-lang/rust/pull/69738
2020-03-16 18:38:30 +01:00
bors
24f6d643fe
Auto merge of #5322 - phansch:or_patterns, r=matthiaskrgr
...
Make use of `or_patterns` feature
changelog: none
2020-03-16 12:41:04 +00:00
Matthias Krüger
ba0884bee3
rustup https://github.com/rust-lang/rust/pull/68944
2020-03-16 11:36:17 +01:00
Philipp Hansch
548c417ec4
Make use of or_patterns
feature
2020-03-16 07:25:09 +01:00
Yuki Okushi
3e3776666e
Rustup to rust-lang/rust#69674
2020-03-13 04:56:55 +09:00
Yuki Okushi
3d44ad2e32
Use try_eval_usize
over eval_usize
2020-03-03 21:40:24 +09:00
Yuki Okushi
4253aa7137
Rustup to rust-lang/rust#69592
2020-03-01 12:23:33 +09:00
flip1995
8472ecda0f
Fix fallout
2020-02-21 11:14:18 +01:00
Yuki Okushi
f56e8b7eb4
Rename FunctionRetTy
to FnRetTy
2020-02-17 19:07:08 +09:00
Matthew Jasper
787398aa53
Avoid using regions from TypeckTables
...
These regions will all be `ReErased` soon.
2020-02-15 16:24:49 +00:00
Lily Chung
385fd7cd0a
change in the right place, run update_lints
2020-02-12 17:03:49 -08:00
Areredify
66ad544175
improve 'iter_nth_zero' documentation
2020-02-03 15:44:55 +03:00
Ludwig Stecher
1f600f3f9a
Un-ignore most code blocks to render correctly on website, correct mistakes
2020-01-30 23:44:37 +01:00
Ludwig Stecher
58da5ba6db
Fix code formatting for more lints
2020-01-30 22:12:00 +01:00
Ludwig Stecher
f0dc98160b
Fix syntax highlighting of code fence
...
The documentation for RESULT_EXPECT_USED includes this code:
let res: Result<usize, ()> = Ok(1);
res?;
# Ok::<(), ()>(())
Because the code fence didn't start with `rust`, the code wasn't highlighted and the line starting with `#` was displayed on the website. This is now fixed.
2020-01-30 21:55:30 +01:00
xiongmao86
ac9f019fbf
Reformat code.
2020-01-30 00:23:47 +08:00
Yuki Okushi
f5e86d6894
Rename span_note_and_lint
to span_lint_and_note
2020-01-27 11:26:42 +09:00
Yuki Okushi
f60f12f71f
Rename span_help_and_lint
to span_lint_and_help
2020-01-27 11:17:58 +09:00
Yuki Okushi
4b133f2867
Apply review comments
2020-01-26 07:01:16 +09:00
Yuki Okushi
2dc73c45d5
Clean up methods/mod.rs
2020-01-24 17:04:37 +09:00
Areredify
796958c7e2
add option_as_ref_deref
lint
2020-01-23 16:12:16 +03:00
bors
eca0d8e5d0
Auto merge of #5067 - JohnTitor:lint-skip-while-next, r=flip1995
...
Add `skip_while_next` lint
Fixes #4036
changelog: Add `skip_while_next` lint
2020-01-20 17:28:38 +00:00
Yuki Okushi
bec5b69e45
Apply review comment
2020-01-20 21:07:31 +09:00
Yuki Okushi
f8034e0bc6
Improve suspicious_map
documentation
2020-01-20 15:05:40 +09:00
Yuki Okushi
95c369fa91
Add skip_while_next
lint
2020-01-20 10:56:02 +09:00
Yuki Okushi
e72f0e61c6
Rustup to rust-lang/rust#68204
2020-01-18 14:39:18 +09:00
bors
c24a42289b
Auto merge of #4543 - xiongmao86:issue4503, r=flip1995
...
Fix issue4503
Fixes #4503 .
changelog: Add a lint checking user are using FileType.is_file() method and suggest using !FileType.is_dir().
- [x] Followed [lint naming conventions][lint_naming]
- [x] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `./util/dev update_lints`
- [x] Added lint documentation
- [x] Run `./util/dev fmt`
2020-01-13 22:09:39 +00:00
Yuki Okushi
ce1c6b285d
Rustup to rust-lang/rust#68045
2020-01-13 21:55:57 +09:00
xiongmao86
2b477f361e
Update lints again.
2020-01-12 19:54:17 +08:00
xiongmao86
77c48ca341
Fix grammar error.
2020-01-12 19:54:17 +08:00
Rui
1018b78f41
Update clippy_lints/src/methods/mod.rs
...
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2020-01-12 19:54:17 +08:00
xiongmao86
8d3cc6b8a9
Change lint message.
2020-01-12 19:54:17 +08:00
Rui
a73822d3b9
Fix documents and messages.
...
Update clippy_lints/src/methods/mod.rs
2020-01-12 19:54:17 +08:00
xiongmao86
8d333a3cbb
Extend spans to include !.
2020-01-12 19:54:17 +08:00
xiongmao86
3c59eaf91c
Add lint logic.
2020-01-12 19:54:17 +08:00
xiongmao86
96334d0d7c
Declare lint.
2020-01-12 19:54:17 +08:00
Yuki Okushi
39947992b5
Rustup to rust-lang/rust#67806
2020-01-11 21:50:00 +09:00
Yuki Okushi
e58cfac458
Rustup to rust-lang/rust#67979
2020-01-09 16:43:51 +09:00
Yuki Okushi
5ac08b0cc9
Normalize lint messages
2020-01-07 18:26:55 +09:00
Yuki Okushi
2f2eaf8b7e
Rustup to rust-lang/rust#67886
2020-01-07 01:46:33 +09:00
Brad Sherman
ab5ff0352e
Add lint for iter.nth(0)
...
- Encourage iter.next() rather than iter.nth(0), which is less readable
2020-01-04 11:20:11 -06:00
Philipp Hansch
c5178e82b4
Rustup to https://github.com/rust-lang/rust/pull/67853
...
Specifically caused by https://github.com/rust-lang/rust/pull/67786
2020-01-04 11:30:03 +01:00
Yuki Okushi
1102b87e3a
Remove use of try!
from documentation
2020-01-04 13:47:01 +09:00
Yuki Okushi
9086b17e14
Rustup to rust-lang/rust#67707
2019-12-31 09:17:56 +09:00
bors
cecaca3382
Auto merge of #4634 - m-ober:feature/2320-map-or, r=llogiq
...
Add real suggestion to option_map_unwrap_or
changelog: Add real suggestion to `option_map_unwrap_or`
Fixes #2320
2019-12-30 15:50:06 +00:00
Yuki Okushi
a4c201e6b4
Rustup to rust-lang/rust#66942
2019-12-30 13:02:10 +09:00
Micha Ober
c5046fdce5
Add real suggestion to option_map_unwrap_or
2019-12-28 23:24:45 +01:00
Yuki Okushi
e2636729ec
Rustup to rust-lang/rust#66936
2019-12-27 16:13:53 +09:00
flip1995
9632e27487
Add <'_> where necessary
2019-12-22 15:42:41 +01:00
Lzu Tao
d1ca5f1d7c
rustup "Merge ast::Mutability
and mir::Mutability
"
2019-12-21 18:38:45 +00:00
bors
b4ad56e5c4
Auto merge of #4920 - lily-commure:fix-unnecessary-filter-map-docs, r=phansch
...
Fix documentation example for unnecessary_filter_map.
Fixes #4919 .
changelog: none
2019-12-20 07:27:24 +00:00
bors
a86463c99f
Auto merge of #4913 - mikerite:step-by-zero-20191218, r=phansch
...
Move `iterator_step_by_zero` and correct the documentation
Move `iterator_step_by_zero` and correct the documentation.
changelog: Corrected `iterator_step_by_zero` documentation
2019-12-20 07:10:11 +00:00
Lily Chung
6e8c2bf8e6
Fix documentation example for unnecessary_filter_map.
2019-12-19 15:48:17 -08:00
Michael Wright
1559f8bf34
Fix expect_fun_call
false negative on references
...
Closes #4912
2019-12-19 06:57:56 +02:00