Skip to content

Commit 0b92c6e

Browse files
authored
Merge branch 'master' into case_sensitive_file_extensions
2 parents 07a9204 + 976850b commit 0b92c6e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1635
-257
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: Bug Report (False Negative)
3+
about: Create a bug report about missing warnings from a lint
4+
labels: L-bug, L-false-negative
5+
---
6+
<!--
7+
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
8+
along with any information you feel relevant to replicating the bug.
9+
-->
10+
Lint name:
11+
12+
13+
I tried this code:
14+
15+
```rust
16+
<code>
17+
```
18+
19+
I expected to see this happen: *explanation*
20+
21+
Instead, this happened: *explanation*
22+
23+
### Meta
24+
25+
- `cargo clippy -V`: e.g. clippy 0.0.212 (f455e46 2020-06-20)
26+
- `rustc -Vv`:
27+
```
28+
rustc 1.46.0-nightly (f455e46ea 2020-06-20)
29+
binary: rustc
30+
commit-hash: f455e46eae1a227d735091091144601b467e1565
31+
commit-date: 2020-06-20
32+
host: x86_64-unknown-linux-gnu
33+
release: 1.46.0-nightly
34+
LLVM version: 10.0
35+
```
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: Bug Report (False Positive)
3+
about: Create a bug report about a wrongly emitted lint warning
4+
labels: L-bug, L-false-positive
5+
---
6+
<!--
7+
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
8+
along with any information you feel relevant to replicating the bug.
9+
-->
10+
Lint name:
11+
12+
13+
I tried this code:
14+
15+
```rust
16+
<code>
17+
```
18+
19+
I expected to see this happen: *explanation*
20+
21+
Instead, this happened: *explanation*
22+
23+
### Meta
24+
25+
- `cargo clippy -V`: e.g. clippy 0.0.212 (f455e46 2020-06-20)
26+
- `rustc -Vv`:
27+
```
28+
rustc 1.46.0-nightly (f455e46ea 2020-06-20)
29+
binary: rustc
30+
commit-hash: f455e46eae1a227d735091091144601b467e1565
31+
commit-date: 2020-06-20
32+
host: x86_64-unknown-linux-gnu
33+
release: 1.46.0-nightly
34+
LLVM version: 10.0
35+
```

.github/workflows/clippy.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,16 @@ jobs:
5050
- name: Build
5151
run: cargo build --features deny-warnings,internal-lints
5252

53+
- name: Test "--fix -Zunstable-options"
54+
run: cargo run --features deny-warnings,internal-lints --bin cargo-clippy -- clippy --fix -Zunstable-options
55+
5356
- name: Test
5457
run: cargo test --features deny-warnings,internal-lints
5558

5659
- name: Test clippy_lints
5760
run: cargo test --features deny-warnings,internal-lints
5861
working-directory: clippy_lints
5962

60-
- name: Test --fix -Zunstable-options
61-
run: cargo run --bin cargo-clippy -- clippy --fix -Zunstable-options
62-
working-directory: clippy_lints
63-
6463
- name: Test rustc_tools_util
6564
run: cargo test --features deny-warnings
6665
working-directory: rustc_tools_util

CHANGELOG.md

Lines changed: 133 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,138 @@ document.
66

77
## Unreleased / In Rust Nightly
88

9-
[b20d4c1...master](https://github.com/rust-lang/rust-clippy/compare/b20d4c1...master)
9+
[4911ab1...master](https://github.com/rust-lang/rust-clippy/compare/4911ab1...master)
10+
11+
## Rust 1.50
12+
13+
Current beta, release 2021-02-11
14+
15+
[b20d4c1...4911ab1](https://github.com/rust-lang/rust-clippy/compare/b20d4c1...4911ab1)
16+
17+
### New Lints
18+
19+
* [`suspicious_operation_groupings`] [#6086](https://github.com/rust-lang/rust-clippy/pull/6086)
20+
* [`size_of_in_element_count`] [#6394](https://github.com/rust-lang/rust-clippy/pull/6394)
21+
* [`unnecessary_wraps`] [#6070](https://github.com/rust-lang/rust-clippy/pull/6070)
22+
* [`let_underscore_drop`] [#6305](https://github.com/rust-lang/rust-clippy/pull/6305)
23+
* [`collapsible_match`] [#6402](https://github.com/rust-lang/rust-clippy/pull/6402)
24+
* [`redundant_else`] [#6330](https://github.com/rust-lang/rust-clippy/pull/6330)
25+
* [`zero_sized_map_values`] [#6218](https://github.com/rust-lang/rust-clippy/pull/6218)
26+
* [`print_stderr`] [#6367](https://github.com/rust-lang/rust-clippy/pull/6367)
27+
* [`string_from_utf8_as_bytes`] [#6134](https://github.com/rust-lang/rust-clippy/pull/6134)
28+
29+
### Moves and Deprecations
30+
31+
* Previously deprecated [`str_to_string`] and [`string_to_string`] have been un-deprecated
32+
as `restriction` lints [#6333](https://github.com/rust-lang/rust-clippy/pull/6333)
33+
* Deprecate [`panic_params`] lint. This is now available in rustc as `panic_fmt`
34+
[#6351](https://github.com/rust-lang/rust-clippy/pull/6351)
35+
* Move [`map_err_ignore`] to `restriction`
36+
[#6416](https://github.com/rust-lang/rust-clippy/pull/6416)
37+
* Move [`await_holding_refcell_ref`] to `pedantic`
38+
[#6354](https://github.com/rust-lang/rust-clippy/pull/6354)
39+
* Move [`await_holding_lock`] to `pedantic`
40+
[#6354](https://github.com/rust-lang/rust-clippy/pull/6354)
41+
42+
### Enhancements
43+
44+
* Add the `unreadable-literal-lint-fractions` configuration to disable
45+
the `unreadable_literal` lint for fractions
46+
[#6421](https://github.com/rust-lang/rust-clippy/pull/6421)
47+
* [`clone_on_copy`]: Now shows the type in the lint message
48+
[#6443](https://github.com/rust-lang/rust-clippy/pull/6443)
49+
* [`redundant_pattern_matching`]: Now also lints on `std::task::Poll`
50+
[#6339](https://github.com/rust-lang/rust-clippy/pull/6339)
51+
* [`redundant_pattern_matching`]: Additionally also lints on `std::net::IpAddr`
52+
[#6377](https://github.com/rust-lang/rust-clippy/pull/6377)
53+
* [`search_is_some`]: Now suggests `contains` instead of `find(foo).is_some()`
54+
[#6119](https://github.com/rust-lang/rust-clippy/pull/6119)
55+
* [`clone_double_ref`]: Now prints the reference type in the lint message
56+
[#6442](https://github.com/rust-lang/rust-clippy/pull/6442)
57+
* [`modulo_one`]: Now also lints on -1.
58+
[#6360](https://github.com/rust-lang/rust-clippy/pull/6360)
59+
* [`empty_loop`]: Now lints no_std crates, too
60+
[#6205](https://github.com/rust-lang/rust-clippy/pull/6205)
61+
* [`or_fun_call`]: Now also lints when indexing `HashMap` or `BTreeMap`
62+
[#6267](https://github.com/rust-lang/rust-clippy/pull/6267)
63+
* [`wrong_self_convention`]: Now also lints in trait definitions
64+
[#6316](https://github.com/rust-lang/rust-clippy/pull/6316)
65+
* [`needless_borrow`]: Print the type in the lint message
66+
[#6449](https://github.com/rust-lang/rust-clippy/pull/6449)
67+
68+
[msrv_readme]: https://github.com/rust-lang/rust-clippy#specifying-the-minimum-supported-rust-version
69+
70+
### False Positive Fixes
71+
72+
* [`manual_range_contains`]: No longer lints in `const fn`
73+
[#6382](https://github.com/rust-lang/rust-clippy/pull/6382)
74+
* [`unnecessary_lazy_evaluations`]: No longer lints if closure argument is used
75+
[#6370](https://github.com/rust-lang/rust-clippy/pull/6370)
76+
* [`match_single_binding`]: Now ignores cases with `#[cfg()]` macros
77+
[#6435](https://github.com/rust-lang/rust-clippy/pull/6435)
78+
* [`match_like_matches_macro`]: No longer lints on arms with attributes
79+
[#6290](https://github.com/rust-lang/rust-clippy/pull/6290)
80+
* [`map_clone`]: No longer lints with deref and clone
81+
[#6269](https://github.com/rust-lang/rust-clippy/pull/6269)
82+
* [`map_clone`]: No longer lints in the case of &mut
83+
[#6301](https://github.com/rust-lang/rust-clippy/pull/6301)
84+
* [`needless_update`]: Now ignores `non_exhaustive` structs
85+
[#6464](https://github.com/rust-lang/rust-clippy/pull/6464)
86+
* [`needless_collect`]: No longer lints when a collect is needed multiple times
87+
[#6313](https://github.com/rust-lang/rust-clippy/pull/6313)
88+
* [`unnecessary_cast`] No longer lints cfg-dependent types
89+
[#6369](https://github.com/rust-lang/rust-clippy/pull/6369)
90+
* [`declare_interior_mutable_const`] and [`borrow_interior_mutable_const`]:
91+
Both now ignore enums with frozen variants
92+
[#6110](https://github.com/rust-lang/rust-clippy/pull/6110)
93+
94+
95+
### Suggestion Fixes/Improvements
96+
97+
* [`vec_box`]: Provide correct type scope suggestion
98+
[#6271](https://github.com/rust-lang/rust-clippy/pull/6271)
99+
* [`manual_range_contains`]: Give correct suggestion when using floats
100+
[#6320](https://github.com/rust-lang/rust-clippy/pull/6320)
101+
* [`unnecessary_lazy_evaluations`]: Don't always mark suggestion as MachineApplicable
102+
[#6272](https://github.com/rust-lang/rust-clippy/pull/6272)
103+
* [`manual_async_fn`]: Improve suggestion formatting
104+
[#6294](https://github.com/rust-lang/rust-clippy/pull/6294)
105+
* [`unnecessary_cast`]: Fix incorrectly formatted float literal suggestion
106+
[#6362](https://github.com/rust-lang/rust-clippy/pull/6362)
107+
108+
### ICE Fixes
109+
110+
* Fix a crash in [`from_iter_instead_of_collect`]
111+
[#6304](https://github.com/rust-lang/rust-clippy/pull/6304)
112+
* Fix a silent crash when parsing doc comments in [`needless_doctest_main`]
113+
[#6458](https://github.com/rust-lang/rust-clippy/pull/6458)
114+
115+
### Documentation Improvements
116+
117+
* The lint website search has been improved ([#6477](https://github.com/rust-lang/rust-clippy/pull/6477)):
118+
* Searching for lints with dashes and spaces is possible now. For example
119+
`missing-errors-doc` and `missing errors doc` are now valid aliases for lint names
120+
* Improved fuzzy search in lint descriptions
121+
* Various README improvements
122+
[#6287](https://github.com/rust-lang/rust-clippy/pull/6287)
123+
* Add known problems to [`comparison_chain`] documentation
124+
[#6390](https://github.com/rust-lang/rust-clippy/pull/6390)
125+
* Fix example used in [`cargo_common_metadata`]
126+
[#6293](https://github.com/rust-lang/rust-clippy/pull/6293)
127+
* Improve [`map_clone`] documentation
128+
[#6340](https://github.com/rust-lang/rust-clippy/pull/6340)
129+
130+
### Others
131+
132+
* You can now tell Clippy about the MSRV your project supports. Please refer to
133+
the specific README section to learn more about MSRV support [here][msrv_readme]
134+
[#6201](https://github.com/rust-lang/rust-clippy/pull/6201)
135+
* Add `--no-deps` option to avoid running on path dependencies in workspaces
136+
[#6188](https://github.com/rust-lang/rust-clippy/pull/6188)
10137

11138
## Rust 1.49
12139

13-
Current beta, release 2020-12-31
140+
Current stable, released 2020-12-31
14141

15142
[e636b88...b20d4c1](https://github.com/rust-lang/rust-clippy/compare/e636b88...b20d4c1)
16143

@@ -116,7 +243,7 @@ Current beta, release 2020-12-31
116243

117244
## Rust 1.48
118245

119-
Current stable, released 2020-11-19
246+
Released 2020-11-19
120247

121248
[09bd400...e636b88](https://github.com/rust-lang/rust-clippy/compare/09bd400...e636b88)
122249

@@ -1770,6 +1897,7 @@ Released 2018-09-13
17701897
[`cmp_null`]: https://rust-lang.github.io/rust-clippy/master/index.html#cmp_null
17711898
[`cmp_owned`]: https://rust-lang.github.io/rust-clippy/master/index.html#cmp_owned
17721899
[`cognitive_complexity`]: https://rust-lang.github.io/rust-clippy/master/index.html#cognitive_complexity
1900+
[`collapsible_else_if`]: https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
17731901
[`collapsible_if`]: https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
17741902
[`collapsible_match`]: https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match
17751903
[`comparison_chain`]: https://rust-lang.github.io/rust-clippy/master/index.html#comparison_chain
@@ -1974,6 +2102,7 @@ Released 2018-09-13
19742102
[`needless_doctest_main`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_doctest_main
19752103
[`needless_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
19762104
[`needless_pass_by_value`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
2105+
[`needless_question_mark`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
19772106
[`needless_range_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
19782107
[`needless_return`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
19792108
[`needless_update`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_update
@@ -2153,6 +2282,7 @@ Released 2018-09-13
21532282
[`useless_transmute`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_transmute
21542283
[`useless_vec`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
21552284
[`vec_box`]: https://rust-lang.github.io/rust-clippy/master/index.html#vec_box
2285+
[`vec_init_then_push`]: https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push
21562286
[`vec_resize_to_zero`]: https://rust-lang.github.io/rust-clippy/master/index.html#vec_resize_to_zero
21572287
[`verbose_bit_mask`]: https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask
21582288
[`verbose_file_reads`]: https://rust-lang.github.io/rust-clippy/master/index.html#verbose_file_reads

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.0.212"
3+
version = "0.1.51"
44
authors = [
55
"Manish Goregaokar <manishsmail@gmail.com>",
66
"Andre Bogus <bogusandre@gmail.com>",
@@ -29,7 +29,7 @@ path = "src/driver.rs"
2929

3030
[dependencies]
3131
# begin automatic update
32-
clippy_lints = { version = "0.0.212", path = "clippy_lints" }
32+
clippy_lints = { version = "0.1.50", path = "clippy_lints" }
3333
# end automatic update
3434
semver = "0.11"
3535
rustc_tools_util = { version = "0.2.0", path = "rustc_tools_util" }

clippy_dev/src/bless.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,29 @@ pub static CARGO_TARGET_DIR: SyncLazy<PathBuf> = SyncLazy::new(|| match env::var
1717
});
1818

1919
pub fn bless() {
20-
let test_dirs = [
20+
let test_suite_dirs = [
2121
clippy_project_root().join("tests").join("ui"),
22+
clippy_project_root().join("tests").join("ui-internal"),
2223
clippy_project_root().join("tests").join("ui-toml"),
2324
clippy_project_root().join("tests").join("ui-cargo"),
2425
];
25-
for test_dir in &test_dirs {
26-
WalkDir::new(test_dir)
26+
for test_suite_dir in &test_suite_dirs {
27+
WalkDir::new(test_suite_dir)
2728
.into_iter()
2829
.filter_map(Result::ok)
2930
.filter(|f| f.path().extension() == Some(OsStr::new("rs")))
3031
.for_each(|f| {
31-
update_reference_file(f.path().with_extension("stdout"));
32-
update_reference_file(f.path().with_extension("stderr"));
33-
update_reference_file(f.path().with_extension("fixed"));
32+
let test_name = f.path().strip_prefix(test_suite_dir).unwrap();
33+
34+
update_reference_file(f.path().with_extension("stdout"), test_name.with_extension("stdout"));
35+
update_reference_file(f.path().with_extension("stderr"), test_name.with_extension("stderr"));
36+
update_reference_file(f.path().with_extension("fixed"), test_name.with_extension("fixed"));
3437
});
3538
}
3639
}
3740

38-
fn update_reference_file(reference_file_path: PathBuf) {
39-
let test_output_path = build_dir().join(PathBuf::from(reference_file_path.file_name().unwrap()));
41+
fn update_reference_file(reference_file_path: PathBuf, test_name: PathBuf) {
42+
let test_output_path = build_dir().join(test_name);
4043
let relative_reference_file_path = reference_file_path.strip_prefix(clippy_project_root()).unwrap();
4144

4245
// If compiletest did not write any changes during the test run,

clippy_dev/src/ra_setup.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::fs;
44
use std::fs::File;
55
use std::io::prelude::*;
6-
use std::path::PathBuf;
6+
use std::path::{Path, PathBuf};
77

88
// This module takes an absolute path to a rustc repo and alters the dependencies to point towards
99
// the respective rustc subcrates instead of using extern crate xyz.
@@ -44,7 +44,7 @@ pub fn run(rustc_path: Option<&str>) {
4444
}
4545

4646
fn inject_deps_into_manifest(
47-
rustc_source_dir: &PathBuf,
47+
rustc_source_dir: &Path,
4848
manifest_path: &str,
4949
cargo_toml: &str,
5050
lib_rs: &str,

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "clippy_lints"
33
# begin automatic update
4-
version = "0.0.212"
4+
version = "0.1.51"
55
# end automatic update
66
authors = [
77
"Manish Goregaokar <manishsmail@gmail.com>",

0 commit comments

Comments
 (0)