Skip to content

Commit f9b3a3f

Browse files
committed
Merge branch 'master' of github.com:rust-lang/rust-clippy into use_last
2 parents 2c56abb + ff27988 commit f9b3a3f

Some content is hidden

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

63 files changed

+933
-535
lines changed

CHANGELOG.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,38 @@ All notable changes to this project will be documented in this file.
44

55
## Unreleased / In Rust Beta or Nightly
66

7-
[b2601be...master](https://github.com/rust-lang/rust-clippy/compare/b2601be...master)
7+
[1b89724...master](https://github.com/rust-lang/rust-clippy/compare/1b89724...master)
8+
9+
## Rust 1.33 (2019-02-26)
10+
11+
[b2601be...1b89724](https://github.com/rust-lang/rust-clippy/compare/b2601be...1b89724)
12+
13+
* New lints: [`implicit_return`], [`vec_box`], [`cast_ref_to_mut`]
14+
* The `rust-clippy` repository is now part of the `rust-lang` org.
15+
* Rename `stutter` to `module_name_repetitions`
16+
* Merge `new_without_default_derive` into `new_without_default` lint
17+
* Move `large_digit_groups` from `style` group to `pedantic`
18+
* Expand `bool_comparison` to check for `<`, `<=`, `>`, `>=`, and `!=`
19+
comparisons against booleans
20+
* Expand `no_effect` to detect writes to constants such as `A_CONST.field = 2`
21+
* Expand `redundant_clone` to work on struct fields
22+
* Expand `suspicious_else_formatting` to detect `if .. {..} {..}`
23+
* Expand `use_self` to work on tuple structs and also in local macros
24+
* Fix ICE in `result_map_unit_fn` and `option_map_unit_fn`
25+
* Fix false positives in `implicit_return`
26+
* Fix false positives in `use_self`
27+
* Fix false negative in `clone_on_copy`
28+
* Fix false positive in `doc_markdown`
29+
* Fix false positive in `empty_loop`
30+
* Fix false positive in `if_same_then_else`
31+
* Fix false positive in `infinite_iter`
32+
* Fix false positive in `question_mark`
33+
* Fix false positive in `useless_asref`
34+
* Fix false positive in `wildcard_dependencies`
35+
* Fix false positive in `write_with_newline`
36+
* Add suggestion to `explicit_write`
37+
* Improve suggestions for `question_mark` lint
38+
* Fix incorrect suggestion for `get_unwrap`
839

940
## Rust 1.32 (2019-01-17)
1041

ci/base-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ rustup override set nightly
5959
# avoid loop spam and allow cmds with exit status != 0
6060
set +ex
6161

62-
for file in `find tests -not -path "tests/ui/format.rs" -not -path "tests/ui/formatting.rs" -not -path "tests/ui/empty_line_after_outer_attribute.rs" -not -path "tests/ui/double_parens.rs" -not -path "tests/ui/doc.rs" -not -path "tests/ui/unused_unit.rs" | grep "\.rs$"` ; do
62+
for file in `find tests -not -path "tests/ui/double_parens.rs" -not -path "tests/ui/doc.rs" -not -path "tests/ui/unused_unit.rs" | grep "\.rs$"` ; do
6363
rustfmt ${file} --check
6464
if [ $? -ne 0 ]; then
6565
echo "${file} needs reformatting!"

clippy_lints/src/assign_ops.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
66
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
77
use rustc::{declare_tool_lint, lint_array};
88
use rustc_errors::Applicability;
9-
use syntax::ast;
109

1110
/// **What it does:** Checks for `a = a op b` or `a = b commutative_op a`
1211
/// patterns.
@@ -140,12 +139,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
140139
return; // useless if the trait doesn't exist
141140
};
142141
// check that we are not inside an `impl AssignOp` of this exact operation
143-
let parent_fn = cx.tcx.hir().get_parent(e.id);
144-
let parent_impl = cx.tcx.hir().get_parent(parent_fn);
142+
let parent_fn = cx.tcx.hir().get_parent_item(e.hir_id);
143+
let parent_impl = cx.tcx.hir().get_parent_item(parent_fn);
145144
// the crate node is the only one that is not in the map
146145
if_chain! {
147-
if parent_impl != ast::CRATE_NODE_ID;
148-
if let hir::Node::Item(item) = cx.tcx.hir().get(parent_impl);
146+
if parent_impl != hir::CRATE_HIR_ID;
147+
if let hir::Node::Item(item) = cx.tcx.hir().get_by_hir_id(parent_impl);
149148
if let hir::ItemKind::Impl(_, _, _, _, Some(trait_ref), _, _) =
150149
&item.node;
151150
if trait_ref.path.def.def_id() == trait_id;

clippy_lints/src/booleans.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
77
use rustc::{declare_tool_lint, lint_array};
88
use rustc_data_structures::thin_vec::ThinVec;
99
use rustc_errors::Applicability;
10-
use syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID};
10+
use syntax::ast::LitKind;
1111
use syntax::source_map::{dummy_spanned, Span, DUMMY_SP};
1212

1313
/// **What it does:** Checks for boolean expressions that can be written more
@@ -72,7 +72,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonminimalBool {
7272
_: &'tcx FnDecl,
7373
body: &'tcx Body,
7474
_: Span,
75-
_: NodeId,
75+
_: HirId,
7676
) {
7777
NonminimalBoolVisitor { cx }.visit_body(body)
7878
}
@@ -132,7 +132,6 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
132132
}
133133

134134
let mk_expr = |op| Expr {
135-
id: DUMMY_NODE_ID,
136135
hir_id: DUMMY_HIR_ID,
137136
span: DUMMY_SP,
138137
attrs: ThinVec::new(),

clippy_lints/src/consts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use if_chain::if_chain;
55
use rustc::hir::def::Def;
66
use rustc::hir::*;
77
use rustc::lint::LateContext;
8-
use rustc::ty::subst::{Subst, Substs};
8+
use rustc::ty::subst::{Subst, SubstsRef};
99
use rustc::ty::{self, Instance, Ty, TyCtxt};
1010
use rustc::{bug, span_bug};
1111
use rustc_data_structures::sync::Lrc;
@@ -209,7 +209,7 @@ pub struct ConstEvalLateContext<'a, 'tcx: 'a> {
209209
tables: &'a ty::TypeckTables<'tcx>,
210210
param_env: ty::ParamEnv<'tcx>,
211211
needed_resolution: bool,
212-
substs: &'tcx Substs<'tcx>,
212+
substs: SubstsRef<'tcx>,
213213
}
214214

215215
impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {

clippy_lints/src/copies.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyAndPaste {
125125
..
126126
}) = get_parent_expr(cx, expr)
127127
{
128-
if else_expr.id == expr.id {
128+
if else_expr.hir_id == expr.hir_id {
129129
return;
130130
}
131131
}

clippy_lints/src/cyclomatic_complexity.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc::hir::*;
66
use rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass};
77
use rustc::ty;
88
use rustc::{declare_tool_lint, lint_array};
9-
use syntax::ast::{Attribute, NodeId};
9+
use syntax::ast::Attribute;
1010
use syntax::source_map::Span;
1111

1212
use crate::utils::{in_macro, is_allowed, match_type, paths, span_help_and_lint, LimitStack};
@@ -123,9 +123,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CyclomaticComplexity {
123123
_: &'tcx FnDecl,
124124
body: &'tcx Body,
125125
span: Span,
126-
node_id: NodeId,
126+
hir_id: HirId,
127127
) {
128-
let def_id = cx.tcx.hir().local_def_id(node_id);
128+
let def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
129129
if !cx.tcx.has_attr(def_id, "test") {
130130
self.check(cx, body, span);
131131
}
@@ -222,8 +222,7 @@ fn report_cc_bug(
222222
span: Span,
223223
id: HirId,
224224
) {
225-
let node_id = cx.tcx.hir().hir_to_node_id(id);
226-
if !is_allowed(cx, CYCLOMATIC_COMPLEXITY, node_id) {
225+
if !is_allowed(cx, CYCLOMATIC_COMPLEXITY, id) {
227226
cx.sess().span_note_without_error(
228227
span,
229228
&format!(

clippy_lints/src/default_trait_access.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DefaultTraitAccess {
4545
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
4646
if_chain! {
4747
if let ExprKind::Call(ref path, ..) = expr.node;
48-
if !any_parent_is_automatically_derived(cx.tcx, expr.id);
48+
if !any_parent_is_automatically_derived(cx.tcx, expr.hir_id);
4949
if let ExprKind::Path(ref qpath) = path.node;
5050
if let Some(def_id) = opt_def_id(cx.tables.qpath_def(qpath, path.hir_id));
5151
if match_def_path(cx.tcx, def_id, &paths::DEFAULT_TRAIT_METHOD);

clippy_lints/src/enum_clike.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc::hir::*;
77
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
88
use rustc::mir::interpret::GlobalId;
99
use rustc::ty;
10-
use rustc::ty::subst::Substs;
10+
use rustc::ty::subst::InternalSubsts;
1111
use rustc::ty::util::IntTypeExt;
1212
use rustc::{declare_tool_lint, lint_array};
1313
use syntax::ast::{IntTy, UintTy};
@@ -58,7 +58,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant {
5858
if let Some(ref anon_const) = variant.disr_expr {
5959
let param_env = ty::ParamEnv::empty();
6060
let def_id = cx.tcx.hir().body_owner_def_id(anon_const.body);
61-
let substs = Substs::identity_for_item(cx.tcx.global_tcx(), def_id);
61+
let substs = InternalSubsts::identity_for_item(cx.tcx.global_tcx(), def_id);
6262
let instance = ty::Instance::new(def_id, substs);
6363
let c_id = GlobalId {
6464
instance,

clippy_lints/src/enum_glob_use.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use rustc::hir::def::Def;
55
use rustc::hir::*;
66
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
77
use rustc::{declare_tool_lint, lint_array};
8-
use syntax::ast::NodeId;
98
use syntax::source_map::Span;
109

1110
/// **What it does:** Checks for `use Enum::*`.
@@ -39,7 +38,7 @@ impl LintPass for EnumGlobUse {
3938
}
4039

4140
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EnumGlobUse {
42-
fn check_mod(&mut self, cx: &LateContext<'a, 'tcx>, m: &'tcx Mod, _: Span, _: NodeId) {
41+
fn check_mod(&mut self, cx: &LateContext<'a, 'tcx>, m: &'tcx Mod, _: Span, _: HirId) {
4342
// only check top level `use` statements
4443
for item in &m.item_ids {
4544
self.lint_item(cx, cx.tcx.hir().expect_item(item.id));

0 commit comments

Comments
 (0)