bors
b06856eae0
Auto merge of #6187 - geoffreycopin:master, r=ebroto
...
Lint unnecessary int-to-int and float-to-float casts
This is an implementation of a lint that detects unnecessary casts of number literals, as discussed here:
https://github.com/rust-lang/rust-clippy/issues/6116
---
changelog: lint unnecessary as-casts of literals when they could be written using literal syntax.
2020-10-24 23:29:49 +00:00
bors
29979ad043
Auto merge of #6190 - montrivo:manual_result_unwrap_or, r=ebroto
...
manual_unwrap_or / support Result::unwrap_or
Implements partially #5923 .
changelog: support Result::unwrap_or in manual_unwrap_or
2020-10-24 23:09:14 +00:00
Cauê Baasch de Souza
e8731a926c
Add large_types_passed_by_value lint
...
Refactor trivially_copy_pass_by_ref and the new lint into pass_by_ref_or_value module
Update stderr of conf_unknown_key test
Rename lint to large_types_passed_by_value
Increase `pass_by_value_size_limit` default value to 256
Improve rules for `large_types_passed_by_value`
Improve tests for `large_types_passed_by_value`
Improve documentation for `large_types_passed_by_value`
Make minor corrections to pass_by_ref_or_value.rs suggested by clippy itself
Fix `large_types_passed_by_value` example and improve docs
pass_by_ref_or_value: Tweak check for mut annotation in params
large_types_passed_by_value: add tests for pub trait, trait impl and inline attributes
2020-10-24 14:46:56 -03:00
Geoffrey Copin
71ac0c0be8
Keep separators in cast_size_32bits stderr
2020-10-24 14:08:53 +02:00
Tim Nielens
0d21ae0e19
manual-unwrap-or / pr remarks, round 3
2020-10-24 11:35:05 +02:00
ThibsG
62f60e1ae5
No lint with cfg!
and fix sugg for macro in needless_bool
lint
2020-10-24 09:37:23 +02:00
Geoffrey Copin
d46edd9966
Keep sign in int-to-float casts
2020-10-24 00:04:37 +02:00
Eduardo Broto
cdb555f4fc
Merge commit 'bf1c6f9871f430e284b17aa44059e0d0395e28a6' into clippyup
2020-10-23 22:16:59 +02:00
Eduardo Broto
d17edaa152
Merge remote-tracking branch 'upstream/master' into rustup
2020-10-23 14:37:17 +02:00
Joe Richey
3807634a47
clippy_lints: Update empty_loop lint
...
We also update the documentation to note that the remediations are
different for `std` and `no_std` crates.
Signed-off-by: Joe Richey <joerichey@google.com>
2020-10-22 22:03:13 -07:00
Geoffrey Copin
30f80c3b8c
Fix test file
2020-10-23 00:33:15 +02:00
Geoffrey Copin
02f01104bf
Add test case for negative literals
2020-10-23 00:04:27 +02:00
Geoffrey Copin
e8f12d2f02
Address review comments
2020-10-22 23:56:49 +02:00
Tim Nielens
6533d8becf
manual-unwrap-or / pr remarks, round 2
2020-10-22 23:39:59 +02:00
Tim Nielens
f2da0c701e
manual-unwrap-or / pr remarks
2020-10-22 22:46:10 +02:00
varkor
fcde7683fe
Fix clippy tests
2020-10-22 13:23:14 +01:00
Andre Bogus
c693de350a
New lint: manual-range-contains
2020-10-22 08:45:21 +02:00
cgm616
e70817e712
Update tests and add known problems to docs
2020-10-21 21:21:11 -04:00
cgm616
4a4f998c39
Add new lint for undropped ManuallyDrop values
2020-10-21 21:21:11 -04:00
Daniel Smith
4d3322525d
Separate tests for each lint
2020-10-21 11:04:26 -04:00
Daniel Smith
ee20ebadaf
Move refcell lint into shared module
2020-10-21 11:04:26 -04:00
Daniel Smith
3ed69cdb13
Move existing lint into shared file
2020-10-21 11:04:26 -04:00
Daniel Smith
b3a427d873
Add another test case
2020-10-21 11:04:26 -04:00
Daniel Smith
0f4abbf99a
Better naming post copy/paste
2020-10-21 11:04:26 -04:00
Daniel Smith
8727169f72
fmt
2020-10-21 11:04:26 -04:00
Daniel Smith
57bf80f776
Add lint for holding RefCell Ref across an await
2020-10-21 11:04:26 -04:00
Tim Nielens
65b52d84f8
needless-lifetime / multiple where clause predicates regression
2020-10-20 00:42:00 +02:00
bors
eaffd0e418
Auto merge of #6167 - ThibsG:IdenticalArgumentsAssertEq3574, r=ebroto
...
Identical arguments on assert macro family
Lint when identical args are used on `assert_eq!`, `debug_assert_eq!`, `assert_ne!` and `debug_assert_ne!` macros.
Added to the lint `eq_op`.
Common functions added to `utils/higher.rs`
Fixes : #3574
Fixes : #4694
changelog: Lint on identical args when calling `assert_eq!`, `debug_assert_eq!`, `assert_ne!` and `debug_assert_ne!` macros
2020-10-19 19:50:12 +00:00
ThibsG
16b5f37b5a
Split eq_op
ui tests to avoid file limit error in CI
2020-10-19 17:36:48 +02:00
Patrick José Pereira
ba1ca19c3b
tests: if_same_then_else2: Ignore single_element_loop lint
...
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-10-19 09:53:35 -03:00
Patrick José Pereira
ec23db9496
Add linter for a single element for loop
...
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-10-19 09:53:35 -03:00
Tim Nielens
915ce36087
manual_unwrap_or / support Result::unwrap_or
2020-10-18 01:18:59 +02:00
Geoffrey Copin
bb0ce32423
Lint unnecessary int-to-int and float-to-float casts
2020-10-17 16:12:51 +02:00
bors
4e83a38618
Auto merge of #6123 - montrivo:less_concise_than, r=ebroto
...
add lint manual_unwrap_or
Implements partially #5923 .
changelog: add lint manual_unwrap_or
2020-10-16 20:43:45 +00:00
bors
a771557ee9
Auto merge of #6178 - josephlr:sync-from-rust, r=phansch
...
Sync from rust
Fix rustc breakage by running:
```rust
git subtree push -P src/tools/clippy git@github.com:josephlr/rust-clippy sync-from-rust
```
and then adding a commit that runs `cargo dev fmt`
---
changelog: none
2020-10-16 07:45:42 +00:00
Dylan DPC
d2feccc1ef
Rollup merge of #77493 - hosseind88:ICEs_should_always_print_the_top_of_the_query_stack, r=oli-obk
...
ICEs should always print the top of the query stack
see #76920
2020-10-16 02:10:09 +02:00
Chris Ayoup
32e2021b75
Lint items after statements in macro expansions
...
The items_after_statements lint was skipping all expansions. Instead
we should still lint local macros.
Fixes #578
2020-10-14 23:49:48 -04:00
Tim Nielens
690a6a6c0e
manual-unwrap-or / remove unwrap_or_else suggestion due to ownership issues
2020-10-14 22:52:07 +02:00
Tim Nielens
fc846c37fc
manual_unwrap_or / use consts::constant_simple helper
2020-10-14 22:16:48 +02:00
Tim Nielens
6d4eeeabcd
manual-unwrap-or / pr remarks
2020-10-14 22:16:48 +02:00
Tim Nielens
07b2da884c
add lint less_concise_than_option_unwrap_or
2020-10-14 22:16:48 +02:00
ThibsG
71c29b5be8
Add iterator test case for eq_op
lint
2020-10-14 21:29:53 +02:00
hosseind88
ab0fc477b8
fix stderr file of clippy/custom_ice_message test
2020-10-14 18:19:26 +03:30
ThibsG
121a047645
Move linting of assert
macros from early to late pass
2020-10-13 23:57:22 +02:00
bors
0b77c35965
Auto merge of #6169 - ThibsG:SameFunctionsInIfConditionIgnoreMacro, r=ebroto
...
Fix FP in `same_functions_in_if_condition` lint about condition as macro
Ignore expr that originate from a macro.
Fixes : #6168
changelog: none
2020-10-13 16:01:11 +00:00
ThibsG
e2124086b8
Fix FP in same_functions_in_if_condition
lint about condition as macro
2020-10-13 11:31:13 +02:00
ThibsG
a3e0446afe
Extend to the assert
macro family
2020-10-13 09:31:53 +02:00
ThibsG
32fdb8fb0c
Lint on identical variable used as args in assert_eq!
macro call
2020-10-12 23:38:31 +02:00
bors
18ffea01ee
Auto merge of #6158 - giraffate:improve_updating_references, r=phansch
...
Remove the generated files by `update-references.sh` if they are empty
An empty file may be generated by `update-references.sh` and committed as is when creating a patch like https://github.com/rust-lang/rust-clippy/pull/6101#issuecomment-702076508 and https://github.com/rust-lang/rust-clippy/pull/6079#pullrequestreview-496502721 . So, I think it would be helpful to add documentation, and automatically remove the generated file if it's empty.
changelog: none
2020-10-12 13:49:19 +00:00
Eduardo Broto
74ae116131
Use lowercase in error messages
2020-10-11 22:28:55 +02:00