Tim Nielens
6bf5434e19
copy_on_clone - add machine applicability
2020-06-24 01:01:44 +02:00
Aaron Hill
6b3ee8f600
Update Clippy for MethodCall changes
2020-06-10 17:30:11 -04:00
Lzu Tao
8db24840f7
Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy
2020-06-09 14:36:01 +00:00
Mazdak Farrokhzad
78f158e80e
dogfood unnested_or_patterns
2020-06-07 21:16:03 +02:00
Philipp Hansch
623faac84e
Cleanup: Use rustc's same_types
instead of our same_tys
2020-06-06 11:50:59 +02:00
bors
5cb9ef390a
Auto merge of #5664 - ThibsG:GiveCorrectedCode, r=flip1995
...
Give corrected code
This PR adds corrected code for doc examples.
I did this in several commits to facilitate review.
Don't hesitate to tell me if I forgot some.
Also, sometimes I felt it was not necessary to give corrected code, but I maybe wrong.
fixes : #4829
changelog: Improve documentation examples across multiple lints.
2020-06-02 12:11:28 +00:00
bors
f760d77bdb
Auto merge of #5597 - esamudera:slice_iter_next, r=flip1995
...
New lint: iter_next_slice
Hello, this is a work-in-progress PR for issue: https://github.com/rust-lang/rust-clippy/issues/5572
I have implemented lint to replace `iter().next()` for `slice[index..]` and `array` with `get(index)` and `get(0)` respectively. However since I made a lot of changes, I would like to request some feedback before continuing so that I could fix mistakes.
Thank you!
---
changelog: implement `iter_next_slice` lint and test, and modify `needless_continues`, `for_loop_over_options_result` UI tests since they have `iter().next()`
2020-06-02 11:42:22 +00:00
ThibsG
137a3b4d32
Corrected doc PR fixes
2020-06-01 10:49:48 +02:00
ThibsG
9893254dff
Add more corrected code for doc
2020-06-01 10:39:52 +02:00
Ericko Samudera
32fde0b511
New lint: iter_next_slice
2020-06-01 03:08:51 +07:00
flip1995
a0e9f9bd0d
Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2
2020-05-28 15:45:24 +02:00
Jeremy Stucki
bcfeb4de15
Fix build
2020-05-25 21:41:20 +02:00
Jeremy Stucki
566377f627
Ignore calls to 'len'
2020-05-25 21:41:20 +02:00
flip1995
6b3cf63bf5
Fix dogfood fallout
2020-05-22 14:45:51 +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
mikerite
710e06dd29
Fix iterator_step_by_zero
description in declaration
...
Co-Authored-By: Phil Hansch <dev@phansch.net>
2019-12-19 06:51:26 +02:00
Michael Wright
38d0b2199a
Correct iterator_step_by_zero
documentation
2019-12-18 18:59:59 +02:00
Michael Wright
e097fca4df
Update iterator_step_by_zero
...
Move `iterator_step_by_zero` into `methods` since it applies to all
iterators and not just ranges. Simplify the code while doing so.
2019-12-18 18:59:43 +02:00
Matthias Krüger
98e433d70d
Rustup to rust-lang/rust#66878
2019-12-04 01:34:01 +01:00
Phil Hansch
a05f3cb9a1
Rollup merge of #4847 - rust-lang:offest, r=phansch
...
fixing a typo
changelog: none
2019-11-28 10:19:06 +01:00
Lzu Tao
d0e0ffa99f
make use of Result::map_or
2019-11-28 10:52:20 +07:00
Manish Goregaokar
341e266508
Add BorrowKind::Ref
2019-11-27 14:39:28 -08:00
Andre Bogus
47ef5394de
fixing a typo
2019-11-25 14:06:34 +01:00
flip1995
d2d62de841
Rustup to rust-lang/rust#64856
2019-11-25 13:56:24 +01:00
flip1995
d43c424145
Rustup to rust-lang/rust#66671
2019-11-25 13:18:38 +01:00
bors
cc35165f52
Auto merge of #4840 - flip1995:rollup-jqk3a3i, r=flip1995
...
Rollup of 5 pull requests
Successful merges:
- #4730 (Fix check_infinite_loop (while_immutable_condition) by checking for break or return inside loop body)
- #4766 (Fix false positive in derive_hash_xor_eq)
- #4811 (Literal Representation Restructure)
- #4820 (doc: fix the comment above the lint function)
- #4830 (use more efficient code to generate repeated string)
Failed merges:
r? @ghost
changelog: none
2019-11-23 17:40:57 +00:00
Philipp Krones
ae69bc4980
Rollup merge of #4820 - guanqun:comment-fix, r=flip1995
...
doc: fix the comment above the lint function
it's a simple comment fix.
---
changelog: none
2019-11-23 18:16:01 +01:00
Andre Bogus
c21b198576
New lint: zst_offset
2019-11-15 22:39:27 +01:00
Guanqun Lu
f2d8197110
doc: fix the comment above the lint function
2019-11-16 01:55:06 +08:00
Manish Goregaokar
e9a3e54910
MutImmutable -> Immutable, MutMutable -> Mutable, CaptureClause -> CaptureBy
2019-11-11 10:58:39 -08:00
flip1995
08fd397c2c
Deprecate into_iter_on_array
lint
...
This lint was uplifted/reimplemented by rustc.
Rustup to rust-lang/rust#66017
2019-11-07 14:04:29 +01:00
Lzu Tao
51632530d7
rustup rust-lang/rust#65776
2019-11-06 17:46:45 +07:00
Lzu Tao
4c7387e965
rustup https://github.com/rust-lang/rust/pull/65535
2019-10-19 12:27:21 +07:00
Heinz N. Gies
7f454d8d06
Split out tests
2019-10-18 07:40:48 +02:00
Heinz N. Gies
a7ad78f3eb
Add expect
...
Co-Authored-By: Philipp Krones <hello@philkrones.com>
2019-10-18 07:37:58 +02:00
Michael Zhang
2106a23966
Update help text in inefficient_to_string
...
Co-Authored-By: Manish Goregaokar <manishsmail@gmail.com>
2019-10-17 19:13:32 -04:00
HMPerson1
76b44f34b9
Add inefficient_to_string
lint
2019-10-16 15:54:20 -04:00
Andre Bogus
cc622608db
new lints around #[must_use]
fns
...
`must_use_unit` lints unit-returning functions with a `#[must_use]`
attribute, suggesting to remove it.
`double_must_use` lints functions with a plain `#[must_use]`
attribute, but which return a type which is already `#[must_use]`,
so the attribute has no benefit.
`must_use_candidate` is a pedantic lint that lints functions and
methods that return some non-unit type that is not already
`#[must_use]` and suggests to add the annotation.
2019-10-14 12:09:04 +02:00
bors
b690cdb1e7
Auto merge of #4611 - rust-lang:doc-visibility, r=flip1995
...
account for doc visibility
This fixes #4608 .
Also I noticed that the lint failed to look at trait and impl items. There's a small bit of fallout in the code, too, but not enough to warrant its own commit.
changelog: check docs of trait items and impl items, also make `missing_safety_doc` account for visibility
2019-10-08 07:11:26 +00:00
flip1995
3aa531c194
Run util/dev fmt
2019-10-05 12:42:09 +02:00
flip1995
3b23092b69
Get rid of rvalue_promotable_map method call
2019-10-05 12:38:38 +02:00
Andre Bogus
e3f143ff0a
account for doc visibility
2019-10-02 21:15:28 +02:00
flip1995
4bbd10a585
Rustup to rust-lang/rust#64813
2019-09-27 17:21:20 +02:00
Lzu Tao
a7b7e19f49
Rustup https://github.com/rust-lang/rust/pull/64513
2019-09-26 16:03:36 +07:00
Matthias Krüger
b72982759c
run rustfmt
2019-09-11 08:26:57 +02:00
bors
4ee8bc84cd
Auto merge of #4527 - rust-lang:more-vec-diag-items, r=oli-obk
...
Changed more `Vec` paths to diagnostic_items
In #4519 , I missed a few instances of path matching for `Vec`, so here they are.
r? @oli-obk
changelog: none
2019-09-09 16:56:51 +00:00
bors
c733376a5f
Auto merge of #4522 - mikerite:fix-4514, r=phansch
...
Fix `or_fun_call` bad suggestion
Closes #4514
changelog: Fix `or_fun_call` bad suggestion
2019-09-09 15:38:59 +00:00
Andre Bogus
507c03a859
Changed more Vec paths to diagnostic_items
2019-09-09 17:22:41 +02:00
Andre Bogus
e3c4ffd4aa
Use diagnostic item for
2019-09-09 05:43:39 +02:00
Michael Wright
9bdfd0683f
Fix or_fun_call
bad suggestion
...
Closes #4514
2019-09-08 11:03:45 +02:00
Jeremy Stucki
3fc1ec1ffd
Refactor option handling
2019-09-04 16:19:59 +02:00
bors
ffe57fad85
Auto merge of #4498 - sinkuu:checked_arithmetic_unwrap, r=flip1995
...
Add manual_saturating_arithmetic lint
changelog: add `manual_saturating_arithmetic` lint
Fixes #1557 . This lint detects manual saturating arithmetics like `x.checked_add(10u32).unwrap_or(u32::max_value())` and suggests replacing with `x.saturating_add(10u32)`.
2019-09-04 12:14:41 +00:00
Shotaro Yamada
c6fb9c8a2a
Hide variables in doc-test
2019-09-04 21:10:08 +09:00
Shotaro Yamada
45fde0f86f
Fix doctest and renaming src
2019-09-04 21:06:28 +09:00
Shotaro Yamada
4960f79476
Add manual_saturating_arithmetic lint
2019-09-04 18:38:25 +09:00
bors
8239b7616f
Auto merge of #4454 - BO41:search_is_some, r=flip1995
...
Dereference one less on search_is_some and make it auto-fixable
Fixes #4453
changelog: none
2019-09-04 07:53:44 +00:00
BO41
64cd9e4d60
Try to fix .fixed
2019-09-03 18:56:23 +02:00
Andre Bogus
b01f2d1126
lint against MaybeUninit::uninit().assume_init()
2019-09-03 17:37:38 +02:00
flip1995
3c11406c1f
Rustup to rust-lang/rust#60966
2019-08-30 10:11:27 +02:00
flip1995
dac81d867b
Use the spans returned by utils::method_calls
2019-08-29 17:34:03 +02:00
BO41
945d4cf69f
Dereference one less on search_is_some and make it auto-fixable
2019-08-29 17:34:02 +02:00
Yuki Okushi
2c282252a9
Replace Arg
with Param
2019-08-28 18:33:25 +09:00
bors
f760088820
Auto merge of #4430 - lzutao:defid_trait_alias, r=flip1995
...
Account for trait alias when looking for defid
I hit the crash on the `expect` call when running clippy on rustc libcore.
Hopefully this will fix it.
changelog: none
2019-08-26 12:46:00 +00:00
bors
ba6681300e
Auto merge of #4436 - BO41:written_as, r=phansch
...
Add some "could be written as" examples
fixes #4405
changelog: none
2019-08-26 11:11:57 +00:00
Lzu Tao
dac2509bac
Account for trait alias when looking for defid
2019-08-25 20:36:11 +07:00
BO41
31a6ab47e1
Fix lint doc
2019-08-24 13:57:25 +02:00
Jeremy Stucki
2da8288433
Refactor some minor things
2019-08-23 22:52:04 +02:00
Jeremy Stucki
907aebcf8b
Use more if-chains
2019-08-23 22:51:44 +02:00
Jeremy Stucki
4130dfba2e
Refactor 'lint_or_fun_call'
2019-08-23 22:31:22 +02:00
Jeremy Stucki
419c87fb35
Refactor 'check_unwrap_or_default'
2019-08-23 14:36:00 +02:00
Jeremy Stucki
1436fea271
Refactor 'check_impl_item'
2019-08-23 14:20:55 +02:00
BO41
eebb7cd839
Add examples to some complexity lints
2019-08-22 15:41:07 +02:00
BO41
43a2ba34e6
Add examples to some correctness lints
2019-08-22 15:41:07 +02:00
Michael Wright
59893bcab0
Fix temporary_cstring_as_ptr
false negative
...
Fixes #4375 .
Changes the check to test when `.unwrap().as_ptr()` is called on any
`Result<CString, _>` as suggested by @flip1995
(https://github.com/rust-lang/rust-clippy/issues/4375#issuecomment-520724123 ).
2019-08-21 07:35:04 +02:00
KRAAI, MATTHEW [VISUS]
204b2f3658
Remove in_macro_or_desugar
2019-08-19 09:30:32 -07:00
bors
5c71c1b838
Auto merge of #4411 - mikerite:fix-4384, r=flip1995
...
Fix `clone_on_copy` false positives
Closes #4384
changelog: Fix `clone_on_copy` false positives
2019-08-19 08:04:12 +00:00
Michael Wright
68a1af540c
Fix clone_on_copy
false positives
...
Closes #4384
2019-08-19 08:19:54 +02:00
Lzu Tao
7065239da5
Add option_and_then_some lint
2019-08-19 03:54:40 +00:00
Jeremy Stucki
9c39c02b75
Change lint type to 'complexity'
2019-08-18 16:49:11 +02:00
Jeremy Stucki
f4f31a4ff4
Implement lint 'suspicious_map'
2019-08-15 22:58:32 +02:00
Jeremy Stucki
fdf82eb1a8
Remove unused import
2019-08-14 20:24:05 +02:00
Jeremy Stucki
08f658bc72
Use different span
2019-08-14 19:35:06 +02:00
bors
63d2d066f9
Auto merge of #4369 - mikerite:fix-4293, r=flip1995
...
Fix `wrong_self_convention` issue
Resolves #4293
changelog: Fix `wrong_self_convention` issue
2019-08-14 10:59:36 +00:00
Jeremy Stucki
2bfcf89f82
Merge branch 'origin/master' into flat-map
2019-08-14 07:36:37 +02:00
Jeremy Stucki
d578c43c51
Use correct span
2019-08-13 21:50:42 +02:00
Jeremy Stucki
d51136d594
Use 'span_lint_and_sugg'
2019-08-12 21:42:57 +02:00
Jeremy Stucki
3a65e4e75a
Minor refactoring
2019-08-12 21:29:33 +02:00
Jeremy Stucki
09e9568c26
Change lint type from 'pedantic' → 'complexity'
2019-08-12 10:53:23 +02:00
Jeremy Stucki
df9063013e
Update rustdoc
2019-08-11 22:18:58 +02:00
Jeremy Stucki
5fd7d44f36
Refactor if_chain
...
Co-authored-by: Philipp Krones <hello@philkrones.com>
2019-08-11 21:02:01 +02:00
Jeremy Stucki
b651f19eb8
Rename 'flat_map' → 'flat_map_identity'
2019-08-11 20:34:25 +02:00
Jeremy Stucki
f0ce04f814
Handle calls with 'std::convert::identity'
2019-08-11 19:51:43 +02:00
Jeremy Stucki
05d9f884e1
Merge branch 'origin/master' into flat-map
2019-08-11 19:22:40 +02:00
Michael Wright
77278ccda9
Fix wrong_self_convention
issue
...
Resolves #4293
2019-08-10 06:01:15 +02:00
Michael Wright
170d4861c6
Simplify wrong_self_convention
code
...
Use actual types instead of hir types.
2019-08-10 06:00:27 +02:00
Michael Wright
ebd24985bf
Rename implitem to impl_item
...
`impl_item` is proper snake case and used everywhere else.
2019-08-10 05:58:52 +02:00
Lukas Markeffsky
d7b9a845aa
new_ret_no_self: walk associated types in impl Trait return types
2019-08-09 17:44:05 +02:00
bors
c55d38ed7a
Auto merge of #4362 - lzutao:expect-on-cstring_as_ptr, r=flip1995
...
Fix lint_cstring_as_ptr for expect
Closes #4312
changelog: none
2019-08-09 09:22:02 +00:00
Lzu Tao
c23a5c586f
Fix lint_cstring_as_ptr for expect
2019-08-09 12:39:33 +07:00
Lzu Tao
30cbdc7491
Fix lint_single_char_pattern on raw string literal
2019-08-09 10:55:30 +07:00
Lzu Tao
e4f8cd9672
Rustup https://github.com/rust-lang/rust/pull/59369
2019-08-06 19:20:41 +07:00
Philipp Krones
93c3da223f
Rollup merge of #4331 - phansch:doctests_restriction, r=flip1995
...
Doctests: Enable running doc tests for restriction lints
changelog: Enabled remaining doc tests for lint documentation page
master: 202 passed; 0 failed; 122 ignored; 0 measured; 0 filtered out
this PR: 231 passed; 0 failed; 123 ignored; 0 measured; 0 filtered out
Closes #4319 (assuming this is merged after #4329 and #4330 )
2019-08-05 10:50:06 +02:00