Skip to content

Commit 3aee654

Browse files
authored
Merge pull request #2880 from mati865/rustup_hir
Rustup
2 parents 656b26e + a24f77f commit 3aee654

Some content is hidden

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

53 files changed

+196
-187
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ All notable changes to this project will be documented in this file.
617617
[`block_in_if_condition_expr`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#block_in_if_condition_expr
618618
[`block_in_if_condition_stmt`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#block_in_if_condition_stmt
619619
[`bool_comparison`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#bool_comparison
620+
[`borrow_interior_mutable_const`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#borrow_interior_mutable_const
620621
[`borrowed_box`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#borrowed_box
621622
[`box_vec`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#box_vec
622623
[`boxed_local`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#boxed_local
@@ -641,6 +642,7 @@ All notable changes to this project will be documented in this file.
641642
[`crosspointer_transmute`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#crosspointer_transmute
642643
[`cyclomatic_complexity`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#cyclomatic_complexity
643644
[`decimal_literal_representation`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#decimal_literal_representation
645+
[`declare_interior_mutable_const`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#declare_interior_mutable_const
644646
[`default_trait_access`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#default_trait_access
645647
[`deprecated_semver`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#deprecated_semver
646648
[`deref_addrof`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#deref_addrof

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ We are currently in the process of discussing Clippy 1.0 via the RFC process in
99

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

12-
[There are 270 lints included in this crate!](https://rust-lang-nursery.github.io/rust-clippy/master/index.html)
12+
[There are 272 lints included in this crate!](https://rust-lang-nursery.github.io/rust-clippy/master/index.html)
1313

1414
We have a bunch of lint categories to allow you to choose how much clippy is supposed to ~~annoy~~ help you:
1515

clippy_lints/src/attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
195195

196196
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx ImplItem) {
197197
if is_relevant_impl(cx.tcx, item) {
198-
check_attrs(cx, item.span, item.name, &item.attrs)
198+
check_attrs(cx, item.span, item.ident.name, &item.attrs)
199199
}
200200
}
201201

202202
fn check_trait_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx TraitItem) {
203203
if is_relevant_trait(cx.tcx, item) {
204-
check_attrs(cx, item.span, item.name, &item.attrs)
204+
check_attrs(cx, item.span, item.ident.name, &item.attrs)
205205
}
206206
}
207207
}

clippy_lints/src/blacklisted_name.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ impl LintPass for BlackListedName {
4141

4242
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlackListedName {
4343
fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) {
44-
if let PatKind::Binding(_, _, ref ident, _) = pat.node {
45-
if self.blacklist.iter().any(|s| ident.node == *s) {
44+
if let PatKind::Binding(_, _, ident, _) = pat.node {
45+
if self.blacklist.iter().any(|s| ident.name == *s) {
4646
span_lint(
4747
cx,
4848
BLACKLISTED_NAME,
4949
ident.span,
50-
&format!("use of a blacklisted/placeholder name `{}`", ident.node),
50+
&format!("use of a blacklisted/placeholder name `{}`", ident.name),
5151
);
5252
}
5353
}

clippy_lints/src/booleans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl<'a, 'tcx, 'v> SuggestContext<'a, 'tcx, 'v> {
203203
METHODS_WITH_NEGATION
204204
.iter().cloned()
205205
.flat_map(|(a, b)| vec![(a, b), (b, a)])
206-
.find(|&(a, _)| a == path.name.as_str())
206+
.find(|&(a, _)| a == path.ident.as_str())
207207
.and_then(|(_, neg_method)| Some(format!("{}.{}()", self.snip(&args[0])?, neg_method)))
208208
},
209209
_ => None,

clippy_lints/src/bytecount.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount {
3939
fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
4040
if_chain! {
4141
if let ExprMethodCall(ref count, _, ref count_args) = expr.node;
42-
if count.name == "count";
42+
if count.ident.name == "count";
4343
if count_args.len() == 1;
4444
if let ExprMethodCall(ref filter, _, ref filter_args) = count_args[0].node;
45-
if filter.name == "filter";
45+
if filter.ident.name == "filter";
4646
if filter_args.len() == 2;
4747
if let ExprClosure(_, _, body_id, _, _) = filter_args[1].node;
4848
then {
@@ -68,7 +68,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount {
6868
}
6969
let haystack = if let ExprMethodCall(ref path, _, ref args) =
7070
filter_args[0].node {
71-
let p = path.name;
71+
let p = path.ident.name;
7272
if (p == "iter" || p == "iter_mut") && args.len() == 1 {
7373
&args[0]
7474
} else {
@@ -104,7 +104,7 @@ fn get_path_name(expr: &Expr) -> Option<Name> {
104104
} else {
105105
None
106106
},
107-
ExprPath(ref qpath) => single_segment_path(qpath).map(|ps| ps.name),
107+
ExprPath(ref qpath) => single_segment_path(qpath).map(|ps| ps.ident.name),
108108
_ => None,
109109
}
110110
}

clippy_lints/src/copies.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ fn bindings<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, pat: &Pat) -> HashMap<LocalInt
269269
PatKind::TupleStruct(_, ref pats, _) => for pat in pats {
270270
bindings_impl(cx, pat, map);
271271
},
272-
PatKind::Binding(_, _, ref ident, ref as_pat) => {
273-
if let Entry::Vacant(v) = map.entry(ident.node.as_str()) {
272+
PatKind::Binding(_, _, ident, ref as_pat) => {
273+
if let Entry::Vacant(v) = map.entry(ident.as_str()) {
274274
v.insert(cx.tables.pat_ty(pat));
275275
}
276276
if let Some(ref as_pat) = *as_pat {

clippy_lints/src/duration_subsec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DurationSubsec {
4343
if match_type(cx, walk_ptrs_ty(cx.tables.expr_ty(&args[0])), &paths::DURATION);
4444
if let Some((Constant::Int(divisor), _)) = constant(cx, cx.tables, right);
4545
then {
46-
let suggested_fn = match (method_path.name.as_str().as_ref(), divisor) {
46+
let suggested_fn = match (method_path.ident.as_str().as_ref(), divisor) {
4747
("subsec_micros", 1_000) => "subsec_millis",
4848
("subsec_nanos", 1_000) => "subsec_micros",
4949
("subsec_nanos", 1_000_000) => "subsec_millis",

clippy_lints/src/entry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn check_cond<'a, 'tcx, 'b>(
9090
if_chain! {
9191
if let ExprMethodCall(ref path, _, ref params) = check.node;
9292
if params.len() >= 2;
93-
if path.name == "contains_key";
93+
if path.ident.name == "contains_key";
9494
if let ExprAddrOf(_, ref key) = params[1].node;
9595
then {
9696
let map = &params[0];
@@ -125,7 +125,7 @@ impl<'a, 'tcx, 'b> Visitor<'tcx> for InsertVisitor<'a, 'tcx, 'b> {
125125
if_chain! {
126126
if let ExprMethodCall(ref path, _, ref params) = expr.node;
127127
if params.len() == 3;
128-
if path.name == "insert";
128+
if path.ident.name == "insert";
129129
if get_item_name(self.cx, self.map) == get_item_name(self.cx, &params[0]);
130130
if SpanlessEq::new(self.cx).eq_expr(self.key, &params[1]);
131131
then {

clippy_lints/src/enum_variants.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl LintPass for EnumVariantNames {
121121
}
122122

123123
fn var2str(var: &Variant) -> LocalInternedString {
124-
var.node.ident.name.as_str()
124+
var.node.ident.as_str()
125125
}
126126

127127
/// Returns the number of chars that match from the start
@@ -245,7 +245,7 @@ impl EarlyLintPass for EnumVariantNames {
245245
}
246246

247247
fn check_item(&mut self, cx: &EarlyContext, item: &Item) {
248-
let item_name = item.ident.name.as_str();
248+
let item_name = item.ident.as_str();
249249
let item_name_chars = item_name.chars().count();
250250
let item_camel = to_camel_case(&item_name);
251251
if !in_macro(item.span) {

0 commit comments

Comments
 (0)