Skip to content

Commit 7f868c9

Browse files
committed
Merge branch 'master' of github.com:rust-lang/rust-clippy
2 parents 714272f + c6e43b1 commit 7f868c9

File tree

169 files changed

+1233
-2688
lines changed

Some content is hidden

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

169 files changed

+1233
-2688
lines changed

.cargo/config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[alias]
22
uitest = "test --test compile-test"
3+
4+
[build]
5+
rustflags = ["-Zunstable-options"]

.github/PULL_REQUEST_TEMPLATE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--
2+
Thank you for making Clippy better!
3+
4+
We're collecting our changelog from pull request descriptions.
5+
If your PR only updates to the latest nightly, you can leave the
6+
`changelog` entry as `none`. Otherwise, please write a short comment
7+
explaining your change.
8+
9+
If your PR fixes an issue, you can add "fixes #issue_number" into this
10+
PR description. This way the issue will be automatically closed when
11+
your PR is merged.
12+
13+
If you added a new lint, here's a checklist for things that will be
14+
checked during review or continuous integration.
15+
16+
- [ ] Followed [lint naming conventions][lint_naming]
17+
- [ ] Added passing UI tests (including committed `.stderr` file)
18+
- [ ] `cargo test` passes locally
19+
- [ ] Executed `util/dev update_lints`
20+
- [ ] Added lint documentation
21+
- [ ] Run `cargo fmt`
22+
23+
Note that you can skip the above if you are just opening a WIP PR in
24+
order to get feedback.
25+
26+
Delete this line and everything above before opening your PR -->
27+
28+
changelog: none

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,7 @@ All notable changes to this project will be documented in this file.
10151015
[`panic_params`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic_params
10161016
[`panicking_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#panicking_unwrap
10171017
[`partialeq_ne_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_ne_impl
1018+
[`path_buf_push_overwrite`]: https://rust-lang.github.io/rust-clippy/master/index.html#path_buf_push_overwrite
10181019
[`possible_missing_comma`]: https://rust-lang.github.io/rust-clippy/master/index.html#possible_missing_comma
10191020
[`precedence`]: https://rust-lang.github.io/rust-clippy/master/index.html#precedence
10201021
[`print_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#print_literal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

10-
[There are 298 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
10+
[There are 299 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
1111

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

clippy_dev/rust-toolchain

Lines changed: 0 additions & 1 deletion
This file was deleted.

clippy_dev/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(clippy::default_hash_types)]
2-
31
use itertools::Itertools;
42
use lazy_static::lazy_static;
53
use regex::Regex;

clippy_lints/src/approx_const.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::utils::span_lint;
22
use rustc::hir::*;
33
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
4-
use rustc::{declare_tool_lint, lint_array};
4+
use rustc::{declare_lint_pass, declare_tool_lint};
55
use std::f64::consts as f64;
66
use syntax::ast::{FloatTy, Lit, LitKind};
77
use syntax::symbol;
@@ -53,20 +53,9 @@ const KNOWN_CONSTS: &[(f64, &str, usize)] = &[
5353
(f64::SQRT_2, "SQRT_2", 5),
5454
];
5555

56-
#[derive(Copy, Clone)]
57-
pub struct Pass;
56+
declare_lint_pass!(ApproxConstant => [APPROX_CONSTANT]);
5857

59-
impl LintPass for Pass {
60-
fn get_lints(&self) -> LintArray {
61-
lint_array!(APPROX_CONSTANT)
62-
}
63-
64-
fn name(&self) -> &'static str {
65-
"ApproxConstant"
66-
}
67-
}
68-
69-
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
58+
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ApproxConstant {
7059
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
7160
if let ExprKind::Lit(lit) = &e.node {
7261
check_lit(cx, lit, e);

clippy_lints/src/arithmetic.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::consts::constant_simple;
22
use crate::utils::span_lint;
33
use rustc::hir;
44
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
5-
use rustc::{declare_tool_lint, lint_array};
5+
use rustc::{declare_tool_lint, impl_lint_pass};
66
use syntax::source_map::Span;
77

88
declare_clippy_lint! {
@@ -48,15 +48,7 @@ pub struct Arithmetic {
4848
const_span: Option<Span>,
4949
}
5050

51-
impl LintPass for Arithmetic {
52-
fn get_lints(&self) -> LintArray {
53-
lint_array!(INTEGER_ARITHMETIC, FLOAT_ARITHMETIC)
54-
}
55-
56-
fn name(&self) -> &'static str {
57-
"Arithmetic"
58-
}
59-
}
51+
impl_lint_pass!(Arithmetic => [INTEGER_ARITHMETIC, FLOAT_ARITHMETIC]);
6052

6153
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Arithmetic {
6254
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {

clippy_lints/src/assertions_on_constants.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use if_chain::if_chain;
22
use rustc::hir::{Expr, ExprKind};
33
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
4-
use rustc::{declare_tool_lint, lint_array};
4+
use rustc::{declare_lint_pass, declare_tool_lint};
55

66
use crate::consts::{constant, Constant};
77
use crate::syntax::ast::LitKind;
@@ -29,17 +29,7 @@ declare_clippy_lint! {
2929
"`assert!(true)` / `assert!(false)` will be optimized out by the compiler, and should probably be replaced by a `panic!()` or `unreachable!()`"
3030
}
3131

32-
pub struct AssertionsOnConstants;
33-
34-
impl LintPass for AssertionsOnConstants {
35-
fn get_lints(&self) -> LintArray {
36-
lint_array![ASSERTIONS_ON_CONSTANTS]
37-
}
38-
39-
fn name(&self) -> &'static str {
40-
"AssertionsOnConstants"
41-
}
42-
}
32+
declare_lint_pass!(AssertionsOnConstants => [ASSERTIONS_ON_CONSTANTS]);
4333

4434
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssertionsOnConstants {
4535
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {

clippy_lints/src/assign_ops.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use if_chain::if_chain;
22
use rustc::hir;
33
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
44
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
5-
use rustc::{declare_tool_lint, lint_array};
5+
use rustc::{declare_lint_pass, declare_tool_lint};
66
use rustc_errors::Applicability;
77

88
use crate::utils::{
@@ -53,18 +53,7 @@ declare_clippy_lint! {
5353
"having a variable on both sides of an assign op"
5454
}
5555

56-
#[derive(Copy, Clone, Default)]
57-
pub struct AssignOps;
58-
59-
impl LintPass for AssignOps {
60-
fn get_lints(&self) -> LintArray {
61-
lint_array!(ASSIGN_OP_PATTERN, MISREFACTORED_ASSIGN_OP)
62-
}
63-
64-
fn name(&self) -> &'static str {
65-
"AssignOps"
66-
}
67-
}
56+
declare_lint_pass!(AssignOps => [ASSIGN_OP_PATTERN, MISREFACTORED_ASSIGN_OP]);
6857

6958
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
7059
#[allow(clippy::too_many_lines)]

0 commit comments

Comments
 (0)