Skip to content

Commit 631481f

Browse files
committed
Merge remote-tracking branch 'upstream/master' into rustup
2 parents 5f8686e + f9ca9d4 commit 631481f

File tree

88 files changed

+1808
-660
lines changed

Some content is hidden

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

88 files changed

+1808
-660
lines changed

.github/driver.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ test "$sysroot" = $desired_sysroot
1717
sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot)
1818
test "$sysroot" = $desired_sysroot
1919

20+
# Check that the --sysroot argument is only passed once (SYSROOT is ignored)
21+
(
22+
cd rustc_tools_util
23+
touch src/lib.rs
24+
SYSROOT=/tmp RUSTFLAGS="--sysroot=$(rustc --print sysroot)" ../target/debug/cargo-clippy clippy --verbose
25+
)
26+
2027
# Make sure this isn't set - clippy-driver should cope without it
2128
unset CARGO_MANIFEST_DIR
2229

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4137,6 +4137,7 @@ Released 2018-09-13
41374137
[`derive_hash_xor_eq`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_hash_xor_eq
41384138
[`derive_ord_xor_partial_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_ord_xor_partial_ord
41394139
[`derive_partial_eq_without_eq`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq
4140+
[`derived_hash_with_manual_eq`]: https://rust-lang.github.io/rust-clippy/master/index.html#derived_hash_with_manual_eq
41404141
[`disallowed_macros`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_macros
41414142
[`disallowed_method`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_method
41424143
[`disallowed_methods`]: https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_methods

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ filetime = "0.2"
4242
rustc-workspace-hack = "1.0"
4343

4444
# UI test dependencies
45+
clap = { version = "3.1", features = ["derive"] }
4546
clippy_utils = { path = "clippy_utils" }
4647
derive-new = "0.5"
4748
if_chain = "1.0"

book/src/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Installation
22

3-
If you're using `rustup` to install and manage you're Rust toolchains, Clippy is
3+
If you're using `rustup` to install and manage your Rust toolchains, Clippy is
44
usually **already installed**. In that case you can skip this chapter and go to
55
the [Usage] chapter.
66

clippy_dev/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// warn on lints, that are included in `rust-lang/rust`s bootstrap
66
#![warn(rust_2018_idioms, unused_lifetimes)]
77

8+
// The `rustc_driver` crate seems to be required in order to use the `rust_lexer` crate.
9+
#[allow(unused_extern_crates)]
10+
extern crate rustc_driver;
811
extern crate rustc_lexer;
912

1013
use std::path::PathBuf;

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ quine-mc_cluskey = "0.2"
1919
regex-syntax = "0.6"
2020
serde = { version = "1.0", features = ["derive"] }
2121
serde_json = { version = "1.0", optional = true }
22-
tempfile = { version = "3.2", optional = true }
22+
tempfile = { version = "3.3.0", optional = true }
2323
toml = "0.5"
2424
unicode-normalization = "0.1"
2525
unicode-script = { version = "0.5", default-features = false }

clippy_lints/src/blocks_in_if_conditions.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ impl<'tcx> LateLintPass<'tcx> for BlocksInIfConditions {
8585
);
8686
}
8787
} else {
88-
let span =
89-
block.expr.as_ref().map_or_else(|| block.stmts[0].span, |e| e.span);
88+
let span = block.expr.as_ref().map_or_else(|| block.stmts[0].span, |e| e.span);
9089
if span.from_expansion() || expr.span.from_expansion() {
9190
return;
9291
}

clippy_lints/src/box_default.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_hir::{
88
Block, Expr, ExprKind, Local, Node, QPath, TyKind,
99
};
1010
use rustc_lint::{LateContext, LateLintPass, LintContext};
11-
use rustc_middle::lint::in_external_macro;
11+
use rustc_middle::{lint::in_external_macro, ty::print::with_forced_trimmed_paths};
1212
use rustc_session::{declare_lint_pass, declare_tool_lint};
1313
use rustc_span::sym;
1414

@@ -59,7 +59,7 @@ impl LateLintPass<'_> for BoxDefault {
5959
if is_plain_default(arg_path) || given_type(cx, expr) {
6060
"Box::default()".into()
6161
} else {
62-
format!("Box::<{arg_ty}>::default()")
62+
with_forced_trimmed_paths!(format!("Box::<{arg_ty}>::default()"))
6363
},
6464
Applicability::MachineApplicable
6565
);

clippy_lints/src/copies.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,11 @@ fn check_for_warn_of_moved_symbol(cx: &LateContext<'_>, symbols: &[(HirId, Symbo
525525
.iter()
526526
.filter(|&&(_, name)| !name.as_str().starts_with('_'))
527527
.any(|&(_, name)| {
528-
let mut walker = ContainsName { name, result: false };
528+
let mut walker = ContainsName {
529+
name,
530+
result: false,
531+
cx,
532+
};
529533

530534
// Scan block
531535
block

clippy_lints/src/dbg_macro.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ use rustc_span::sym;
1010

1111
declare_clippy_lint! {
1212
/// ### What it does
13-
/// Checks for usage of dbg!() macro.
13+
/// Checks for usage of the [`dbg!`](https://doc.rust-lang.org/std/macro.dbg.html) macro.
1414
///
1515
/// ### Why is this bad?
16-
/// `dbg!` macro is intended as a debugging tool. It
17-
/// should not be in version control.
16+
/// The `dbg!` macro is intended as a debugging tool. It should not be present in released
17+
/// software or committed to a version control system.
1818
///
1919
/// ### Example
2020
/// ```rust,ignore
@@ -91,8 +91,8 @@ impl LateLintPass<'_> for DbgMacro {
9191
cx,
9292
DBG_MACRO,
9393
macro_call.span,
94-
"`dbg!` macro is intended as a debugging tool",
95-
"ensure to avoid having uses of it in version control",
94+
"the `dbg!` macro is intended as a debugging tool",
95+
"remove the invocation before committing it to a version control system",
9696
suggestion,
9797
applicability,
9898
);

0 commit comments

Comments
 (0)