Skip to content

Commit b860273

Browse files
committed
Merge branch 'master' of github.com:rust-lang/rust-clippy into option_if_let_else
2 parents 48f1b17 + c211cea commit b860273

File tree

199 files changed

+2612
-1444
lines changed

Some content is hidden

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

199 files changed

+2612
-1444
lines changed

.gitattributes

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
[attr]rust text eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4
2-
31
* text=auto eol=lf
4-
*.rs rust
2+
*.rs text eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4
53
*.fixed linguist-language=Rust

.github/deploy.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ if [[ -n $TAG_NAME ]]; then
1717
ln -s "$TAG_NAME" out/stable
1818
fi
1919

20+
if [[ $BETA = "true" ]]; then
21+
echo "Update documentation for the beta release"
22+
cp -r out/master out/beta
23+
fi
24+
2025
# Generate version index that is shown as root index page
2126
cp util/gh-pages/versions.html out/index.html
2227

@@ -35,12 +40,15 @@ fi
3540

3641
if [[ -n $TAG_NAME ]]; then
3742
# Add the new dir
38-
git add $TAG_NAME
43+
git add "$TAG_NAME"
3944
# Update the symlink
4045
git add stable
4146
# Update versions file
4247
git add versions.json
4348
git commit -m "Add documentation for ${TAG_NAME} release: ${SHA}"
49+
elif [[ $BETA = "true" ]]; then
50+
git add beta
51+
git commit -m "Automatic deploy to GitHub Pages (beta): ${SHA}"
4452
else
4553
git add .
4654
git commit -m "Automatic deploy to GitHub Pages: ${SHA}"

.github/workflows/clippy_bors.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,9 @@ jobs:
208208
- name: Extract Binaries
209209
run: |
210210
DIR=$CARGO_TARGET_DIR/debug
211+
rm $DIR/deps/integration-*.d
212+
mv $DIR/deps/integration-* $DIR/integration
211213
find $DIR ! -executable -o -type d ! -path $DIR | xargs rm -rf
212-
mv $DIR/integration-* $DIR/integration
213214
rm -rf $CARGO_TARGET_DIR/release
214215
215216
- name: Upload Binaries

.github/workflows/clippy_dev.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ jobs:
3838
run: cargo build --features deny-warnings
3939
working-directory: clippy_dev
4040

41-
- name: Test limit-stderr-length
42-
run: cargo dev --limit-stderr-length
41+
- name: Test limit_stderr_length
42+
run: cargo dev limit_stderr_length
4343

4444
- name: Test update_lints
4545
run: cargo dev update_lints --check

.github/workflows/deploy.yml

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- master
7+
- beta
78
tags:
89
- rust-1.**
910

@@ -34,6 +35,9 @@ jobs:
3435
run: |
3536
TAG=$(basename ${{ github.ref }})
3637
echo "::set-env name=TAG_NAME::$TAG"
38+
- name: Set beta to true
39+
if: github.ref == 'refs/heads/beta'
40+
run: echo "::set-env name=BETA::true"
3741
- name: Deploy
3842
run: |
3943
eval "$(ssh-agent -s)"

CHANGELOG.md

+128-3
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,136 @@ document.
66

77
## Unreleased / In Rust Beta or Nightly
88

9-
[69f99e7...master](https://github.com/rust-lang/rust-clippy/compare/69f99e7...master)
9+
[329923e...master](https://github.com/rust-lang/rust-clippy/compare/329923e...master)
10+
11+
## Rust 1.43
12+
13+
Current beta, release 2020-04-23
14+
15+
[4ee1206...329923e](https://github.com/rust-lang/rust-clippy/compare/4ee1206...329923e)
16+
17+
### New lints
18+
19+
* [`imprecise_flops`] [#4897](https://github.com/rust-lang/rust-clippy/pull/4897)
20+
* [`suboptimal_flops`] [#4897](https://github.com/rust-lang/rust-clippy/pull/4897)
21+
* [`wildcard_imports`] [#5029](https://github.com/rust-lang/rust-clippy/pull/5029)
22+
* [`single_component_path_imports`] [#5058](https://github.com/rust-lang/rust-clippy/pull/5058)
23+
* [`match_single_binding`] [#5061](https://github.com/rust-lang/rust-clippy/pull/5061)
24+
* [`let_underscore_lock`] [#5101](https://github.com/rust-lang/rust-clippy/pull/5101)
25+
* [`struct_excessive_bools`] [#5125](https://github.com/rust-lang/rust-clippy/pull/5125)
26+
* [`fn_params_excessive_bools`] [#5125](https://github.com/rust-lang/rust-clippy/pull/5125)
27+
* [`option_env_unwrap`] [#5148](https://github.com/rust-lang/rust-clippy/pull/5148)
28+
* [`lossy_float_literal`] [#5202](https://github.com/rust-lang/rust-clippy/pull/5202)
29+
* [`rest_pat_in_fully_bound_structs`] [#5258](https://github.com/rust-lang/rust-clippy/pull/5258)
30+
31+
### Moves and Deprecations
32+
33+
* Move [`unneeded_field_pattern`] to pedantic group [#5200](https://github.com/rust-lang/rust-clippy/pull/5200)
34+
35+
### Enhancements
36+
37+
* Make [`missing_errors_doc`] lint also trigger on `async` functions
38+
[#5181](https://github.com/rust-lang/rust-clippy/pull/5181)
39+
* Add more constants to [`approx_constant`] [#5193](https://github.com/rust-lang/rust-clippy/pull/5193)
40+
* Extend [`question_mark`] lint [#5266](https://github.com/rust-lang/rust-clippy/pull/5266)
41+
42+
### False Positive Fixes
43+
44+
* [`use_debug`] [#5047](https://github.com/rust-lang/rust-clippy/pull/5047)
45+
* [`unnecessary_unwrap`] [#5132](https://github.com/rust-lang/rust-clippy/pull/5132)
46+
* [`zero_prefixed_literal`] [#5170](https://github.com/rust-lang/rust-clippy/pull/5170)
47+
* [`missing_const_for_fn`] [#5216](https://github.com/rust-lang/rust-clippy/pull/5216)
48+
49+
### Suggestion Improvements
50+
51+
* Improve suggestion when blocks of code are suggested [#5134](https://github.com/rust-lang/rust-clippy/pull/5134)
52+
53+
### ICE Fixes
54+
55+
* `misc_early` lints [#5129](https://github.com/rust-lang/rust-clippy/pull/5129)
56+
* [`missing_errors_doc`] [#5213](https://github.com/rust-lang/rust-clippy/pull/5213)
57+
* Fix ICE when evaluating `usize`s [#5256](https://github.com/rust-lang/rust-clippy/pull/5256)
58+
59+
### Documentation
60+
61+
* Improve documentation of [`iter_nth_zero`]
62+
* Add documentation pages for stable releases [#5171](https://github.com/rust-lang/rust-clippy/pull/5171)
63+
64+
### Others
65+
66+
* Clippy now completely runs on GitHub Actions [#5190](https://github.com/rust-lang/rust-clippy/pull/5190)
67+
1068

1169
## Rust 1.42
1270

13-
Current Beta
71+
Current stable, released 2020-03-12
72+
73+
[69f99e7...4ee1206](https://github.com/rust-lang/rust-clippy/compare/69f99e7...4ee1206)
74+
75+
### New lints
76+
77+
* [`filetype_is_file`] [#4543](https://github.com/rust-lang/rust-clippy/pull/4543)
78+
* [`let_underscore_must_use`] [#4823](https://github.com/rust-lang/rust-clippy/pull/4823)
79+
* [`modulo_arithmetic`] [#4867](https://github.com/rust-lang/rust-clippy/pull/4867)
80+
* [`mem_replace_with_default`] [#4881](https://github.com/rust-lang/rust-clippy/pull/4881)
81+
* [`mutable_key_type`] [#4885](https://github.com/rust-lang/rust-clippy/pull/4885)
82+
* [`option_as_ref_deref`] [#4945](https://github.com/rust-lang/rust-clippy/pull/4945)
83+
* [`wildcard_in_or_patterns`] [#4960](https://github.com/rust-lang/rust-clippy/pull/4960)
84+
* [`iter_nth_zero`] [#4966](https://github.com/rust-lang/rust-clippy/pull/4966)
85+
* [`invalid_atomic_ordering`] [#4999](https://github.com/rust-lang/rust-clippy/pull/4999)
86+
* [`skip_while_next`] [#5067](https://github.com/rust-lang/rust-clippy/pull/5067)
87+
88+
### Moves and Deprecations
89+
90+
* Move [`transmute_float_to_int`] from nursery to complexity group
91+
[#5015](https://github.com/rust-lang/rust-clippy/pull/5015)
92+
* Move [`range_plus_one`] to pedantic group [#5057](https://github.com/rust-lang/rust-clippy/pull/5057)
93+
* Move [`debug_assert_with_mut_call`] to nursery group [#5106](https://github.com/rust-lang/rust-clippy/pull/5106)
94+
* Deprecate [`unused_label`] [#4930](https://github.com/rust-lang/rust-clippy/pull/4930)
95+
96+
### Enhancements
97+
98+
* Lint vectored IO in [`unused_io_amount`] [#5027](https://github.com/rust-lang/rust-clippy/pull/5027)
99+
* Make [`vec_box`] configurable by adding a size threshold [#5081](https://github.com/rust-lang/rust-clippy/pull/5081)
100+
* Also lint constants in [`cmp_nan`] [#4910](https://github.com/rust-lang/rust-clippy/pull/4910)
101+
* Fix false negative in [`expect_fun_call`] [#4915](https://github.com/rust-lang/rust-clippy/pull/4915)
102+
* Fix false negative in [`redundant_clone`] [#5017](https://github.com/rust-lang/rust-clippy/pull/5017)
103+
104+
### False Positive Fixes
105+
106+
* [`map_clone`] [#4937](https://github.com/rust-lang/rust-clippy/pull/4937)
107+
* [`replace_consts`] [#4977](https://github.com/rust-lang/rust-clippy/pull/4977)
108+
* [`let_and_return`] [#5008](https://github.com/rust-lang/rust-clippy/pull/5008)
109+
* [`eq_op`] [#5079](https://github.com/rust-lang/rust-clippy/pull/5079)
110+
* [`possible_missing_comma`] [#5083](https://github.com/rust-lang/rust-clippy/pull/5083)
111+
* [`debug_assert_with_mut_call`] [#5106](https://github.com/rust-lang/rust-clippy/pull/5106)
112+
* Don't trigger [`let_underscore_must_use`] in external macros
113+
[#5082](https://github.com/rust-lang/rust-clippy/pull/5082)
114+
* Don't trigger [`empty_loop`] in `no_std` crates [#5086](https://github.com/rust-lang/rust-clippy/pull/5086)
115+
116+
### Suggestion Improvements
117+
118+
* [`option_map_unwrap_or`] [#4634](https://github.com/rust-lang/rust-clippy/pull/4634)
119+
* [`wildcard_enum_match_arm`] [#4934](https://github.com/rust-lang/rust-clippy/pull/4934)
120+
* [`cognitive_complexity`] [#4935](https://github.com/rust-lang/rust-clippy/pull/4935)
121+
* [`decimal_literal_representation`] [#4956](https://github.com/rust-lang/rust-clippy/pull/4956)
122+
* [`unknown_clippy_lints`] [#4963](https://github.com/rust-lang/rust-clippy/pull/4963)
123+
* [`explicit_into_iter_loop`] [#4978](https://github.com/rust-lang/rust-clippy/pull/4978)
124+
* [`useless_attribute`] [#5022](https://github.com/rust-lang/rust-clippy/pull/5022)
125+
* [`if_let_some_result`] [#5032](https://github.com/rust-lang/rust-clippy/pull/5032)
126+
127+
### ICE fixes
128+
129+
* [`unsound_collection_transmute`] [#4975](https://github.com/rust-lang/rust-clippy/pull/4975)
130+
131+
### Documentation
132+
133+
* Improve documentation of [`empty_enum`], [`replace_consts`], [`redundant_clone`], and [`iterator_step_by_zero`]
134+
14135

15136
## Rust 1.41
16137

17-
Current stable, released 2020-01-30
138+
Released 2020-01-30
18139

19140
[c8e3cfb...69f99e7](https://github.com/rust-lang/rust-clippy/compare/c8e3cfb...69f99e7)
20141

@@ -1150,6 +1271,7 @@ Released 2018-09-13
11501271
[`float_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#float_arithmetic
11511272
[`float_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp
11521273
[`float_cmp_const`]: https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp_const
1274+
[`fn_address_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#fn_address_comparisons
11531275
[`fn_params_excessive_bools`]: https://rust-lang.github.io/rust-clippy/master/index.html#fn_params_excessive_bools
11541276
[`fn_to_numeric_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#fn_to_numeric_cast
11551277
[`fn_to_numeric_cast_with_truncation`]: https://rust-lang.github.io/rust-clippy/master/index.html#fn_to_numeric_cast_with_truncation
@@ -1319,6 +1441,7 @@ Released 2018-09-13
13191441
[`redundant_field_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
13201442
[`redundant_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern
13211443
[`redundant_pattern_matching`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
1444+
[`redundant_pub_crate`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pub_crate
13221445
[`redundant_static_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
13231446
[`ref_in_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_in_deref
13241447
[`regex_macro`]: https://rust-lang.github.io/rust-clippy/master/index.html#regex_macro
@@ -1418,6 +1541,8 @@ Released 2018-09-13
14181541
[`useless_vec`]: https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
14191542
[`vec_box`]: https://rust-lang.github.io/rust-clippy/master/index.html#vec_box
14201543
[`verbose_bit_mask`]: https://rust-lang.github.io/rust-clippy/master/index.html#verbose_bit_mask
1544+
[`verbose_file_reads`]: https://rust-lang.github.io/rust-clippy/master/index.html#verbose_file_reads
1545+
[`vtable_address_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#vtable_address_comparisons
14211546
[`while_immutable_condition`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_immutable_condition
14221547
[`while_let_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_let_loop
14231548
[`while_let_on_iterator`]: https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator

CONTRIBUTING.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ and resolved paths.
5454
[`T-AST`] issues will generally need you to match against a predefined syntax structure.
5555
To figure out how this syntax structure is encoded in the AST, it is recommended to run
5656
`rustc -Z ast-json` on an example of the structure and compare with the [nodes in the AST docs].
57-
Usually the lint will end up to be a nested series of matches and ifs, [like so].
57+
Usually the lint will end up to be a nested series of matches and ifs, [like so][deep-nesting].
58+
But we can make it nest-less by using [if_chain] macro, [like this][nest-less].
5859

5960
[`E-medium`] issues are generally pretty easy too, though it's recommended you work on an E-easy issue first.
6061
They are mostly classified as [`E-medium`], since they might be somewhat involved code wise,
@@ -71,7 +72,9 @@ an AST expression). `match_def_path()` in Clippy's `utils` module can also be us
7172
[`E-medium`]: https://github.com/rust-lang/rust-clippy/labels/E-medium
7273
[`ty`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty
7374
[nodes in the AST docs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/ast/
74-
[like so]: https://github.com/rust-lang/rust-clippy/blob/de5ccdfab68a5e37689f3c950ed1532ba9d652a0/src/misc.rs#L34
75+
[deep-nesting]: https://github.com/rust-lang/rust-clippy/blob/557f6848bd5b7183f55c1e1522a326e9e1df6030/clippy_lints/src/mem_forget.rs#L29-L43
76+
[if_chain]: https://docs.rs/if_chain/*/if_chain
77+
[nest-less]: https://github.com/rust-lang/rust-clippy/blob/557f6848bd5b7183f55c1e1522a326e9e1df6030/clippy_lints/src/bit_mask.rs#L124-L150
7578

7679
## Writing code
7780

Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ clippy_lints = { version = "0.0.212", path = "clippy_lints" }
3737
regex = "1"
3838
semver = "0.9"
3939
rustc_tools_util = { version = "0.2.0", path = "rustc_tools_util"}
40-
git2 = { version = "0.12", optional = true }
4140
tempfile = { version = "3.1.0", optional = true }
4241
lazy_static = "1.0"
4342

@@ -60,4 +59,4 @@ rustc_tools_util = { version = "0.2.0", path = "rustc_tools_util"}
6059

6160
[features]
6261
deny-warnings = []
63-
integration = ["git2", "tempfile"]
62+
integration = ["tempfile"]

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
77

88
[There are 361 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
9+
[There are over 350 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
910

1011
We have a bunch of lint categories to allow you to choose how much Clippy is supposed to ~~annoy~~ help you:
1112

@@ -175,6 +176,8 @@ If you do not want to include your lint levels in your code, you can globally en
175176
flags to Clippy during the run: `cargo clippy -- -A clippy::lint_name` will run Clippy with `lint_name` disabled and
176177
`cargo clippy -- -W clippy::lint_name` will run it with that enabled. This also works with lint groups. For example you
177178
can run Clippy with warnings for all lints enabled: `cargo clippy -- -W clippy::pedantic`
179+
If you care only about a single lint, you can allow all others and then explicitly reenable
180+
the lint(s) you are interested in: `cargo clippy -- -Aclippy::all -Wclippy::useless_format -Wclippy::...`
178181

179182
## Contributing
180183

clippy_dev/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2018"
77
[dependencies]
88
bytecount = "0.6"
99
clap = "2.33"
10-
itertools = "0.8"
10+
itertools = "0.9"
1111
regex = "1"
1212
lazy_static = "1.0"
1313
shell-escape = "0.1"

clippy_dev/src/fmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use clippy_dev::clippy_project_root;
1+
use crate::clippy_project_root;
22
use shell_escape::escape;
33
use std::ffi::OsStr;
44
use std::io;

clippy_dev/src/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ use std::fs;
99
use std::path::{Path, PathBuf};
1010
use walkdir::WalkDir;
1111

12+
pub mod fmt;
13+
pub mod new_lint;
14+
pub mod stderr_length_check;
15+
pub mod update_lints;
16+
1217
lazy_static! {
1318
static ref DEC_CLIPPY_LINT_RE: Regex = Regex::new(
1419
r#"(?x)

0 commit comments

Comments
 (0)