Commit Graph

4757 Commits

Author SHA1 Message Date
Urcra
45aa3ef8dd Remove unnecesary format 2020-10-26 01:55:44 +01:00
Urcra
4532dd9e43 run cargo fmt 2020-10-26 01:31:13 +01:00
Urcra
4cf5b5ff70 Run update lints 2020-10-26 01:21:34 +01:00
Urcra
deecfb5d13 Add description to lint 2020-10-26 01:02:10 +01:00
Urcra
4417af801d Revert changes to Cargo.toml file 2020-10-26 00:53:51 +01:00
Urcra
7f7faa1ccf Move implementation into len_zero.rs 2020-10-26 00:51:18 +01:00
Urcra
de5a6d3420 Initial implementation of comparison_to_empty 2020-10-26 00:31:25 +01:00
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
Tim Nielens
0d21ae0e19 manual-unwrap-or / pr remarks, round 3 2020-10-24 11:35:05 +02:00
Geoffrey Copin
d46edd9966 Keep sign in int-to-float casts 2020-10-24 00:04:37 +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
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
Takayuki Nakata
be136b2712 Merge remote-tracking branch 'upstream/master' into sync-from-rust 2020-10-19 13:05:51 +09:00
Tim Nielens
915ce36087 manual_unwrap_or / support Result::unwrap_or 2020-10-18 01:18:59 +02:00
Eduardo Broto
bc43862820 Merge remote-tracking branch 'upstream/master' into rustup 2020-10-17 21:55:46 +02:00
Yuki Okushi
82f775d2c4 Rollup merge of #77851 - exrook:split-btreemap, r=dtolnay
BTreeMap: refactor Entry out of map.rs into its own file

btree/map.rs is approaching the 3000 line mark, splitting out the entry
code buys about 500 lines of headroom.

I've created this PR because the changes I've made in #77438 will push `map.rs` over the 3000 line limit and cause tidy to complain.

I picked `Entry` to factor out because it feels less tightly coupled to the rest of `BTreeMap` than the various iterator implementations.

Related: #60302
2020-10-18 04:11:07 +09:00
Jacob Hughes
29392a1728 Appease the almightly lord clippy, hallowed be thy name 2020-10-17 13:48:54 -04:00
Geoffrey Copin
bb0ce32423 Lint unnecessary int-to-int and float-to-float casts 2020-10-17 16:12:51 +02:00
ThibsG
5a13217ea9 Assert macro args extractor as a common function in higher 2020-10-17 11:54:25 +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
Santiago Pastorino
0af467ebf2 Handle ExprKind::ConstBlock on clippy 2020-10-16 17:14:34 -03:00
Eduardo Broto
701c7e2fba bump cargo_metadata version 2020-10-16 22:11:37 +02:00
bors
e351e5ca69 Auto merge of #6180 - flip1995:rustup, r=flip1995
Update semver 0.10 -> 0.11

r? `@ghost,` blocking CI

changelog: none
2020-10-16 12:24:23 +00:00
flip1995
6d358d29b0
Update semver 0.10 -> 0.11 2020-10-16 14:23:17 +02: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
Joe Richey
ef91de6402
Run cargo dev fmt
Signed-off-by: Joe Richey <joerichey@google.com>
2020-10-15 22:37:53 -07:00
est31
2c1e8cfc62 Remove rustc_session::config::Config
The wrapper type led to tons of target.target
across the compiler. Its ptr_width field isn't
required any more, as target_pointer_width
is already present in parsed form.
2020-10-15 12:02:24 +02: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
a8fb69f065 manual-unwrap-or / more pr remarks 2020-10-14 22:16:48 +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
9c9327980b manual-unwrap-or / rename files 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
Xidorn Quan
e82264860d Add a known problem for transmute_ptr_to_ref lint 2020-10-14 23:15:01 +11:00
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
Eduardo Broto
cd82a29ad1 Merge remote-tracking branch 'upstream/master' into rustup 2020-10-13 17:16:14 +02: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
Eduardo Broto
74ae116131 Use lowercase in error messages 2020-10-11 22:28:55 +02:00
Andre Bogus
6021c23159 New lint: result-unit-err 2020-10-11 22:04:59 +02:00
Jonas Schievink
1178777457 Refactor how SwitchInt stores jump targets 2020-10-10 17:46:11 +02:00
bors
7118d37bf8 Auto merge of #6154 - flip1995:ice_fixes, r=ebroto
Fix two ICEs caused by ty.is_{sized,freeze}

Fixes #6153
Properly fixes #6139

The test case in #6153 is kind of weird. Even removing one of the arguments of the `foo` function prevented the ICE. I think this test case is actually minimal.

changelog: none
2020-10-10 13:29:05 +00:00
flip1995
cf81975d77
Fix two ICEs caused by ty.is_{sized,freeze} 2020-10-10 14:04:14 +02:00
bors
8b70b84639 Auto merge of #6107 - nahuakang:ref_style_link_false_positive, r=flip1995
Ref style link false positive

This PR does not fix #5834, but it records the problematic link text as a **known problem** inside `doc_markdown` lint.

r? `@flip1995`

- [ ] Followed [lint naming conventions][lint_naming]
- [ ] Added passing UI tests (including committed `.stderr` file)
- [x] `cargo test` passes locally
- [x] Executed `cargo dev update_lints`
- [ ] Added lint documentation
- [x] Run `cargo dev fmt`

---

*Please keep the line below*
changelog: Document problematic link text style as known problem for `doc_markdown`
2020-10-10 09:25:46 +00:00