Skip to content

Commit 859b59e

Browse files
committed
submodules: update clippy from 1ff81c1 to 70b93aa
Changes: ```` remove redundant import rustup rust-lang/rust#68404 rustup rust-lang/rust#69644 rustup rust-lang/rust#70344 Move verbose_file_reads to restriction move redundant_pub_crate to nursery readme: explain how to run only a single lint on a codebase Remove dependency on `matches` crate Move useless_transmute to nursery nursery group -> style Update for PR feedback Auto merge of rust-lang#5314 - ehuss:remove-git2, r=flip1995 Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them ```` Fixes #70456
1 parent a3c73a9 commit 859b59e

40 files changed

+513
-99
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,7 @@ Released 2018-09-13
14391439
[`redundant_field_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
14401440
[`redundant_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern
14411441
[`redundant_pattern_matching`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
1442+
[`redundant_pub_crate`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pub_crate
14421443
[`redundant_static_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
14431444
[`ref_in_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_in_deref
14441445
[`regex_macro`]: https://rust-lang.github.io/rust-clippy/master/index.html#regex_macro

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

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

8-
[There are 361 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
8+
[There are 362 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
99

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

@@ -90,6 +90,14 @@ Note that this is still experimental and only supported on the nightly channel:
9090
cargo fix -Z unstable-options --clippy
9191
```
9292

93+
#### Running only a single lint
94+
95+
If you care only about the warnings of a single lint and want to ignore everything else, you
96+
can first deny all the clippy lints and then explicitly enable the lint(s) you care about:
97+
````
98+
cargo clippy -- -Aclippy::all -Wclippy::useless_format
99+
````
100+
93101
### Running Clippy from the command line without installing it
94102

95103
To have cargo compile your crate with Clippy without Clippy installation

clippy_lints/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ cargo_metadata = "0.9.0"
2121
if_chain = "1.0.0"
2222
itertools = "0.9"
2323
lazy_static = "1.0.2"
24-
matches = "0.1.7"
2524
pulldown-cmark = { version = "0.7", default-features = false }
2625
quine-mc_cluskey = "0.2.2"
2726
regex-syntax = "0.6"

clippy_lints/src/block_in_if_condition.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::utils::{differing_macro_contexts, higher, snippet_block_with_applicability, span_lint, span_lint_and_sugg};
2-
use matches::matches;
32
use rustc::hir::map::Map;
43
use rustc::lint::in_external_macro;
54
use rustc_errors::Applicability;

clippy_lints/src/derive.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ fn check_hash_peq<'a, 'tcx>(
9494
if_chain! {
9595
if match_path(&trait_ref.path, &paths::HASH);
9696
if let Some(peq_trait_def_id) = cx.tcx.lang_items().eq_trait();
97-
if !&trait_ref.trait_def_id().is_local();
97+
if let Some(def_id) = &trait_ref.trait_def_id();
98+
if !def_id.is_local();
9899
then {
99100
// Look for the PartialEq implementations for `ty`
100101
cx.tcx.for_each_relevant_impl(peq_trait_def_id, ty, |impl_id| {

clippy_lints/src/eta_reduction.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use if_chain::if_chain;
2-
use matches::matches;
32
use rustc::lint::in_external_macro;
43
use rustc::ty::{self, Ty};
54
use rustc_errors::Applicability;

clippy_lints/src/if_let_some_result.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::utils::{match_type, method_chain_args, paths, snippet_with_applicability, span_lint_and_sugg};
22
use if_chain::if_chain;
33
use rustc_errors::Applicability;
4-
use rustc_hir::{print, Expr, ExprKind, MatchSource, PatKind, QPath};
4+
use rustc_hir::{Expr, ExprKind, MatchSource, PatKind, QPath};
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_session::{declare_lint_pass, declare_tool_lint};
77

@@ -46,7 +46,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OkIfLet {
4646
if let PatKind::TupleStruct(QPath::Resolved(_, ref x), ref y, _) = body[0].pat.kind; //get operation
4747
if method_chain_args(op, &["ok"]).is_some(); //test to see if using ok() methoduse std::marker::Sized;
4848
let is_result_type = match_type(cx, cx.tables.expr_ty(&result_types[0]), &paths::RESULT);
49-
if print::to_string(print::NO_ANN, |s| s.print_path(x, false)) == "Some" && is_result_type;
49+
if rustc_hir_pretty::to_string(rustc_hir_pretty::NO_ANN, |s| s.print_path(x, false)) == "Some" && is_result_type;
5050

5151
then {
5252
let mut applicability = Applicability::MachineApplicable;

clippy_lints/src/items_after_statements.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! lint when items are used after statements
22
33
use crate::utils::span_lint;
4-
use matches::matches;
54
use rustc_ast::ast::{Block, ItemKind, StmtKind};
65
use rustc_lint::{EarlyContext, EarlyLintPass};
76
use rustc_session::{declare_lint_pass, declare_tool_lint};

clippy_lints/src/lib.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ extern crate rustc_errors;
3434
#[allow(unused_extern_crates)]
3535
extern crate rustc_hir;
3636
#[allow(unused_extern_crates)]
37+
extern crate rustc_hir_pretty;
38+
#[allow(unused_extern_crates)]
3739
extern crate rustc_index;
3840
#[allow(unused_extern_crates)]
3941
extern crate rustc_infer;
@@ -285,6 +287,7 @@ pub mod ranges;
285287
pub mod redundant_clone;
286288
pub mod redundant_field_names;
287289
pub mod redundant_pattern_matching;
290+
pub mod redundant_pub_crate;
288291
pub mod redundant_static_lifetimes;
289292
pub mod reference;
290293
pub mod regex;
@@ -323,7 +326,7 @@ pub mod zero_div_zero;
323326
pub use crate::utils::conf::Conf;
324327

325328
mod reexport {
326-
crate use rustc_ast::ast::Name;
329+
pub use rustc_ast::ast::Name;
327330
}
328331

329332
/// Register all pre expansion lints
@@ -745,6 +748,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
745748
&redundant_clone::REDUNDANT_CLONE,
746749
&redundant_field_names::REDUNDANT_FIELD_NAMES,
747750
&redundant_pattern_matching::REDUNDANT_PATTERN_MATCHING,
751+
&redundant_pub_crate::REDUNDANT_PUB_CRATE,
748752
&redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
749753
&reference::DEREF_ADDROF,
750754
&reference::REF_IN_DEREF,
@@ -1021,6 +1025,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10211025
store.register_late_pass(|| box wildcard_imports::WildcardImports);
10221026
store.register_early_pass(|| box macro_use::MacroUseImports);
10231027
store.register_late_pass(|| box verbose_file_reads::VerboseFileReads);
1028+
store.register_late_pass(|| box redundant_pub_crate::RedundantPubCrate::default());
10241029

10251030
store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![
10261031
LintId::of(&arithmetic::FLOAT_ARITHMETIC),
@@ -1059,6 +1064,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10591064
LintId::of(&shadow::SHADOW_REUSE),
10601065
LintId::of(&shadow::SHADOW_SAME),
10611066
LintId::of(&strings::STRING_ADD),
1067+
LintId::of(&verbose_file_reads::VERBOSE_FILE_READS),
10621068
LintId::of(&write::PRINT_STDOUT),
10631069
LintId::of(&write::USE_DEBUG),
10641070
]);
@@ -1351,7 +1357,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
13511357
LintId::of(&transmute::TRANSMUTE_PTR_TO_PTR),
13521358
LintId::of(&transmute::TRANSMUTE_PTR_TO_REF),
13531359
LintId::of(&transmute::UNSOUND_COLLECTION_TRANSMUTE),
1354-
LintId::of(&transmute::USELESS_TRANSMUTE),
13551360
LintId::of(&transmute::WRONG_TRANSMUTE),
13561361
LintId::of(&transmuting_null::TRANSMUTING_NULL),
13571362
LintId::of(&trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF),
@@ -1378,7 +1383,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
13781383
LintId::of(&unwrap::PANICKING_UNWRAP),
13791384
LintId::of(&unwrap::UNNECESSARY_UNWRAP),
13801385
LintId::of(&vec::USELESS_VEC),
1381-
LintId::of(&verbose_file_reads::VERBOSE_FILE_READS),
13821386
LintId::of(&write::PRINTLN_EMPTY_STRING),
13831387
LintId::of(&write::PRINT_LITERAL),
13841388
LintId::of(&write::PRINT_WITH_NEWLINE),
@@ -1553,7 +1557,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15531557
LintId::of(&transmute::TRANSMUTE_INT_TO_FLOAT),
15541558
LintId::of(&transmute::TRANSMUTE_PTR_TO_PTR),
15551559
LintId::of(&transmute::TRANSMUTE_PTR_TO_REF),
1556-
LintId::of(&transmute::USELESS_TRANSMUTE),
15571560
LintId::of(&types::BORROWED_BOX),
15581561
LintId::of(&types::CHAR_LIT_AS_U8),
15591562
LintId::of(&types::OPTION_OPTION),
@@ -1562,7 +1565,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15621565
LintId::of(&types::UNNECESSARY_CAST),
15631566
LintId::of(&types::VEC_BOX),
15641567
LintId::of(&unwrap::UNNECESSARY_UNWRAP),
1565-
LintId::of(&verbose_file_reads::VERBOSE_FILE_READS),
15661568
LintId::of(&zero_div_zero::ZERO_DIVIDED_BY_ZERO),
15671569
]);
15681570

@@ -1670,6 +1672,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
16701672
LintId::of(&mutex_atomic::MUTEX_INTEGER),
16711673
LintId::of(&needless_borrow::NEEDLESS_BORROW),
16721674
LintId::of(&path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE),
1675+
LintId::of(&redundant_pub_crate::REDUNDANT_PUB_CRATE),
1676+
LintId::of(&transmute::USELESS_TRANSMUTE),
16731677
LintId::of(&use_self::USE_SELF),
16741678
]);
16751679
}

clippy_lints/src/lifetimes.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use matches::matches;
21
use rustc::hir::map::Map;
32
use rustc::lint::in_external_macro;
43
use rustc_data_structures::fx::{FxHashMap, FxHashSet};

0 commit comments

Comments
 (0)