Skip to content

Commit 20a28d5

Browse files
committed
Update clippy
1 parent 1748d44 commit 20a28d5

File tree

98 files changed

+1932
-265
lines changed

Some content is hidden

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

98 files changed

+1932
-265
lines changed

.github/PULL_REQUEST_TEMPLATE renamed to .github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<!--
21
Thank you for making Clippy better!
32

43
We're collecting our changelog from pull request descriptions.
@@ -25,6 +24,8 @@ checked during review or continuous integration.
2524
Note that you can skip the above if you are just opening a WIP PR in
2625
order to get feedback.
2726

28-
Delete this line and everything above before opening your PR -->
27+
Delete this line and everything above before opening your PR.
28+
29+
---
2930

3031
changelog: none

.travis.yml

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ matrix:
5656
if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
5757
- env: INTEGRATION=rust-lang-nursery/chalk
5858
if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
59-
# - env: INTEGRATION=rust-lang/rls
60-
# if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
59+
- env: INTEGRATION=rust-lang/rls
60+
if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
6161
- env: INTEGRATION=Geal/nom
6262
if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
6363
- env: INTEGRATION=rust-lang/rustfmt
6464
if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
65-
# - env: INTEGRATION=hyperium/hyper
66-
# if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
65+
- env: INTEGRATION=hyperium/hyper
66+
if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
6767
- env: INTEGRATION=bluss/rust-itertools
6868
if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
6969
- env: INTEGRATION=serde-rs/serde
@@ -72,8 +72,8 @@ matrix:
7272
if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
7373
- env: INTEGRATION=rust-random/rand
7474
if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
75-
# - env: INTEGRATION=rust-lang-nursery/futures-rs
76-
# if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
75+
- env: INTEGRATION=rust-lang-nursery/futures-rs
76+
if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
7777
- env: INTEGRATION=Marwes/combine
7878
if: repo =~ /^rust-lang\/rust-clippy$/ AND branch IN (auto, try)
7979
- env: INTEGRATION=rust-lang-nursery/failure
@@ -91,7 +91,7 @@ matrix:
9191
- os: osx
9292
- os: windows
9393

94-
script:
94+
before_script:
9595
- |
9696
if [ "$TRAVIS_BRANCH" == "auto" ] || [ "$TRAVIS_BRANCH" == "try" ]; then
9797
pr=$(echo $TRAVIS_COMMIT_MESSAGE | grep -o "#[0-9]*" | head -1 | sed 's/^#//g')
@@ -107,28 +107,31 @@ script:
107107
fi
108108
fi
109109
- |
110-
rm rust-toolchain
111-
./setup-toolchain.sh
112-
if [ "$TRAVIS_OS_NAME" == "windows" ]; then
113-
export PATH=$PATH:$(rustc --print sysroot)/bin
114-
else
115-
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
116-
fi
110+
rm rust-toolchain
111+
./setup-toolchain.sh
112+
- |
113+
if [ "$TRAVIS_OS_NAME" == "windows" ]; then
114+
export PATH=$PATH:$(rustc --print sysroot)/bin
115+
else
116+
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
117+
fi
118+
119+
script:
117120
- |
118121
if [ -z ${INTEGRATION} ]; then
119122
travis_wait 30 ./ci/base-tests.sh && sleep 5
120123
else
121124
./ci/integration-tests.sh && sleep 5
122125
fi
123126
124-
after_success: |
125-
#!/bin/bash
126-
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
127-
set -ex
128-
if [ -z ${INTEGRATION} ]; then
129-
./.github/deploy.sh
130-
else
131-
echo "Not deploying, because we're in an integration test run"
127+
after_success:
128+
- |
129+
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
130+
set -e
131+
if [ -z ${INTEGRATION} ]; then
132+
./.github/deploy.sh
133+
else
134+
echo "Not deploying, because we're in an integration test run"
135+
fi
136+
set +e
132137
fi
133-
set +e
134-
fi

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,7 @@ Released 2018-09-13
976976
[`diverging_sub_expression`]: https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression
977977
[`doc_markdown`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
978978
[`double_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_comparisons
979+
[`double_must_use`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_must_use
979980
[`double_neg`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_neg
980981
[`double_parens`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_parens
981982
[`drop_bounds`]: https://rust-lang.github.io/rust-clippy/master/index.html#drop_bounds
@@ -1063,6 +1064,7 @@ Released 2018-09-13
10631064
[`logic_bug`]: https://rust-lang.github.io/rust-clippy/master/index.html#logic_bug
10641065
[`main_recursion`]: https://rust-lang.github.io/rust-clippy/master/index.html#main_recursion
10651066
[`manual_memcpy`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_memcpy
1067+
[`manual_mul_add`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_mul_add
10661068
[`manual_saturating_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_saturating_arithmetic
10671069
[`manual_swap`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_swap
10681070
[`many_single_char_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#many_single_char_names
@@ -1094,6 +1096,8 @@ Released 2018-09-13
10941096
[`modulo_one`]: https://rust-lang.github.io/rust-clippy/master/index.html#modulo_one
10951097
[`multiple_crate_versions`]: https://rust-lang.github.io/rust-clippy/master/index.html#multiple_crate_versions
10961098
[`multiple_inherent_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#multiple_inherent_impl
1099+
[`must_use_candidate`]: https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
1100+
[`must_use_unit`]: https://rust-lang.github.io/rust-clippy/master/index.html#must_use_unit
10971101
[`mut_from_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#mut_from_ref
10981102
[`mut_mut`]: https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut
10991103
[`mut_range_bound`]: https://rust-lang.github.io/rust-clippy/master/index.html#mut_range_bound
@@ -1190,6 +1194,7 @@ Released 2018-09-13
11901194
[`suspicious_else_formatting`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting
11911195
[`suspicious_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_map
11921196
[`suspicious_op_assign_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_op_assign_impl
1197+
[`suspicious_unary_op_formatting`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_unary_op_formatting
11931198
[`temporary_assignment`]: https://rust-lang.github.io/rust-clippy/master/index.html#temporary_assignment
11941199
[`temporary_cstring_as_ptr`]: https://rust-lang.github.io/rust-clippy/master/index.html#temporary_cstring_as_ptr
11951200
[`too_many_arguments`]: https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
@@ -1231,6 +1236,7 @@ Released 2018-09-13
12311236
[`unused_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_collect
12321237
[`unused_io_amount`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_io_amount
12331238
[`unused_label`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_label
1239+
[`unused_self`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
12341240
[`unused_unit`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit
12351241
[`use_debug`]: https://rust-lang.github.io/rust-clippy/master/index.html#use_debug
12361242
[`use_self`]: https://rust-lang.github.io/rust-clippy/master/index.html#use_self

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ You can use [rustup-toolchain-install-master][rtim] to do that:
147147

148148
```bash
149149
cargo install rustup-toolchain-install-master
150-
rustup-toolchain-install-master -n master --force
150+
rustup-toolchain-install-master --force -n master
151151
rustup override set master
152152
cargo test
153153
```

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ authors = [
1111
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
1212
repository = "https://github.com/rust-lang/rust-clippy"
1313
readme = "README.md"
14-
license = "MIT/Apache-2.0"
14+
license = "MIT OR Apache-2.0"
1515
keywords = ["clippy", "lint", "plugin"]
1616
categories = ["development-tools", "development-tools::cargo-plugins"]
1717
build = "build.rs"
@@ -46,7 +46,7 @@ rustc_tools_util = { version = "0.2.0", path = "rustc_tools_util"}
4646

4747
[dev-dependencies]
4848
cargo_metadata = "0.8.0"
49-
compiletest_rs = { version = "0.3.23", features = ["tmp"] }
49+
compiletest_rs = { version = "0.3.24", features = ["tmp"] }
5050
lazy_static = "1.0"
5151
clippy-mini-macro-test = { version = "0.2", path = "mini-macro" }
5252
serde = { version = "1.0", features = ["derive"] }

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
[![Build Status](https://travis-ci.com/rust-lang/rust-clippy.svg?branch=master)](https://travis-ci.com/rust-lang/rust-clippy)
44
[![Windows Build status](https://ci.appveyor.com/api/projects/status/id677xpw1dguo7iw?svg=true)](https://ci.appveyor.com/project/rust-lang-libs/rust-clippy)
5-
[![License: MIT/Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](#license)
5+
[![License: MIT OR Apache-2.0](https://img.shields.io/crates/l/clippy.svg)](#license)
66

77
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
88

9-
[There are 319 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
9+
[There are 325 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
1010

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

appveyor.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ install:
1717
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
1818
- rustup-init.exe -y --default-host %TARGET% --default-toolchain nightly
1919
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
20-
- git ls-remote https://github.com/rust-lang/rust.git master | awk '{print $1}' >rustc-hash.txt
21-
- set /p RUSTC_HASH=<rustc-hash.txt
2220
- del rust-toolchain
2321
- cargo install rustup-toolchain-install-master --debug || echo "rustup-toolchain-install-master already installed"
24-
- rustup-toolchain-install-master %RUSTC_HASH% -f -n master
22+
- rustup-toolchain-install-master -f -n master
2523
- rustup component add rustfmt --toolchain nightly & exit 0 # Format test handles missing rustfmt
2624
- rustup default master
2725
- set PATH=%PATH%;C:\Users\appveyor\.rustup\toolchains\master\bin

clippy_dev/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub struct Lint {
4242
}
4343

4444
impl Lint {
45+
#[must_use]
4546
pub fn new(name: &str, group: &str, desc: &str, deprecation: Option<&str>, module: &str) -> Self {
4647
Self {
4748
name: name.to_lowercase(),
@@ -58,19 +59,22 @@ impl Lint {
5859
}
5960

6061
/// Returns the lints in a `HashMap`, grouped by the different lint groups
62+
#[must_use]
6163
pub fn by_lint_group(lints: &[Self]) -> HashMap<String, Vec<Self>> {
6264
lints
6365
.iter()
6466
.map(|lint| (lint.group.to_string(), lint.clone()))
6567
.into_group_map()
6668
}
6769

70+
#[must_use]
6871
pub fn is_internal(&self) -> bool {
6972
self.group.starts_with("internal")
7073
}
7174
}
7275

7376
/// Generates the Vec items for `register_lint_group` calls in `clippy_lints/src/lib.rs`.
77+
#[must_use]
7478
pub fn gen_lint_group_list(lints: Vec<Lint>) -> Vec<String> {
7579
lints
7680
.into_iter()
@@ -86,6 +90,7 @@ pub fn gen_lint_group_list(lints: Vec<Lint>) -> Vec<String> {
8690
}
8791

8892
/// Generates the `pub mod module_name` list in `clippy_lints/src/lib.rs`.
93+
#[must_use]
8994
pub fn gen_modules_list(lints: Vec<Lint>) -> Vec<String> {
9095
lints
9196
.into_iter()
@@ -103,6 +108,7 @@ pub fn gen_modules_list(lints: Vec<Lint>) -> Vec<String> {
103108
}
104109

105110
/// Generates the list of lint links at the bottom of the README
111+
#[must_use]
106112
pub fn gen_changelog_lint_list(lints: Vec<Lint>) -> Vec<String> {
107113
let mut lint_list_sorted: Vec<Lint> = lints;
108114
lint_list_sorted.sort_by_key(|l| l.name.clone());
@@ -119,6 +125,7 @@ pub fn gen_changelog_lint_list(lints: Vec<Lint>) -> Vec<String> {
119125
}
120126

121127
/// Generates the `register_removed` code in `./clippy_lints/src/lib.rs`.
128+
#[must_use]
122129
pub fn gen_deprecated(lints: &[Lint]) -> Vec<String> {
123130
lints
124131
.iter()

clippy_dev/src/stderr_length_check.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ fn stderr_files() -> impl Iterator<Item = walkdir::DirEntry> {
4242
.filter(|f| f.path().extension() == Some(OsStr::new("stderr")))
4343
}
4444

45+
#[must_use]
4546
fn count_linenumbers(filepath: &str) -> usize {
4647
if let Ok(mut file) = File::open(filepath) {
4748
let mut content = String::new();

clippy_dummy/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build = 'build.rs'
99

1010
repository = "https://github.com/rust-lang/rust-clippy"
1111

12-
license = "MIT/Apache-2.0"
12+
license = "MIT OR Apache-2.0"
1313
keywords = ["clippy", "lint", "plugin"]
1414
categories = ["development-tools", "development-tools::cargo-plugins"]
1515

0 commit comments

Comments
 (0)