Skip to content

Commit 85afbb0

Browse files
committed
Update clippy and rustfmt
1 parent 036dd8b commit 85afbb0

File tree

13 files changed

+13
-22
lines changed

13 files changed

+13
-22
lines changed

src/tools/clippy/clippy_lints/src/default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl LateLintPass<'_> for Default {
134134
if adt.is_struct();
135135
let variant = adt.non_enum_variant();
136136
if adt.did.is_local() || !variant.is_field_list_non_exhaustive();
137-
let module_did = cx.tcx.parent_module(stmt.hir_id).to_def_id();
137+
let module_did = cx.tcx.parent_module(stmt.kind.hir_id()).to_def_id();
138138
if variant
139139
.fields
140140
.iter()

src/tools/clippy/clippy_lints/src/items_after_statements.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl EarlyLintPass for ItemsAfterStatements {
6363
.stmts
6464
.iter()
6565
.map(|stmt| &stmt.kind)
66-
.skip_while(|s| matches!(**s, StmtKind::Item(..) | StmtKind::Empty));
66+
.skip_while(|s| matches!(**s, StmtKind::Item(..) | StmtKind::Empty { id: _ }));
6767

6868
// lint on all further items
6969
for stmt in stmts {

src/tools/clippy/clippy_lints/src/loops/utils.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,6 @@ pub(super) struct LoopNestVisitor {
256256
impl<'tcx> Visitor<'tcx> for LoopNestVisitor {
257257
type Map = Map<'tcx>;
258258

259-
fn visit_stmt(&mut self, stmt: &'tcx Stmt<'_>) {
260-
if stmt.hir_id == self.hir_id {
261-
self.nesting = LookFurther;
262-
} else if self.nesting == Unknown {
263-
walk_stmt(self, stmt);
264-
}
265-
}
266-
267259
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
268260
if self.nesting != Unknown {
269261
return;

src/tools/clippy/clippy_lints/src/slow_vector_initialization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl<'tcx> LateLintPass<'tcx> for SlowVectorInit {
106106
len_expr: len_arg,
107107
};
108108

109-
Self::search_initialization(cx, vi, stmt.hir_id);
109+
Self::search_initialization(cx, vi, stmt.kind.hir_id());
110110
}
111111
}
112112
}

src/tools/clippy/clippy_lints/src/utils/author.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl<'tcx> LateLintPass<'tcx> for Author {
130130
}
131131

132132
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx hir::Stmt<'_>) {
133-
if !has_attr(cx, stmt.hir_id) {
133+
if !has_attr(cx, stmt.kind.hir_id()) {
134134
return;
135135
}
136136
match stmt.kind {

src/tools/clippy/clippy_lints/src/utils/inspector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<'tcx> LateLintPass<'tcx> for DeepCodeInspector {
110110
}
111111

112112
fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx hir::Stmt<'_>) {
113-
if !has_attr(cx.sess(), cx.tcx.hir().attrs(stmt.hir_id)) {
113+
if !has_attr(cx.sess(), cx.tcx.hir().attrs(stmt.kind.hir_id())) {
114114
return;
115115
}
116116
match stmt.kind {

src/tools/clippy/clippy_utils/src/ast_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ pub fn eq_stmt(l: &Stmt, r: &Stmt) -> bool {
226226
},
227227
(Item(l), Item(r)) => eq_item(l, r, eq_item_kind),
228228
(Expr(l), Expr(r)) | (Semi(l), Semi(r)) => eq_expr(l, r),
229-
(Empty, Empty) => true,
229+
(Empty { id: _ }, Empty { id : _ }) => true,
230230
(MacCall(l), MacCall(r)) => {
231231
l.style == r.style && eq_mac_call(&l.mac, &r.mac) && over(&l.attrs, &r.attrs, |l, r| eq_attr(l, r))
232232
},

src/tools/rustfmt/src/attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub(crate) fn get_span_without_attrs(stmt: &ast::Stmt) -> Span {
4343
ast::StmtKind::Item(ref item) => item.span,
4444
ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => expr.span,
4545
ast::StmtKind::MacCall(ref mac_stmt) => mac_stmt.mac.span(),
46-
ast::StmtKind::Empty => stmt.span,
46+
ast::StmtKind::Empty { id: _ } => stmt.span,
4747
}
4848
}
4949

src/tools/rustfmt/src/closures.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ fn rewrite_closure_with_block(
148148

149149
let block = ast::Block {
150150
stmts: vec![ast::Stmt {
151-
id: ast::NodeId::root(),
152151
kind: ast::StmtKind::Expr(ptr::P(body.clone())),
153152
span: body.span,
154153
}],

src/tools/rustfmt/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ fn block_has_statements(block: &ast::Block) -> bool {
11381138
block
11391139
.stmts
11401140
.iter()
1141-
.any(|stmt| !matches!(stmt.kind, ast::StmtKind::Empty))
1141+
.any(|stmt| !matches!(stmt.kind, ast::StmtKind::Empty { id: _ }))
11421142
}
11431143

11441144
/// Checks whether a block contains no statements, expressions, comments, or

src/tools/rustfmt/src/spanned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl Spanned for ast::Stmt {
7373
mk_sp(mac_stmt.attrs[0].span.lo(), self.span.hi())
7474
}
7575
}
76-
ast::StmtKind::Empty => self.span,
76+
ast::StmtKind::Empty { id: _ } => self.span,
7777
}
7878
}
7979
}

src/tools/rustfmt/src/stmt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<'a> Stmt<'a> {
5353
}
5454

5555
pub(crate) fn is_empty(&self) -> bool {
56-
matches!(self.inner.kind, ast::StmtKind::Empty)
56+
matches!(self.inner.kind, ast::StmtKind::Empty { id: _ })
5757
}
5858

5959
fn is_last_expr(&self) -> bool {
@@ -110,7 +110,7 @@ fn format_stmt(
110110
let shape = shape.sub_width(suffix.len())?;
111111
format_expr(ex, expr_type, context, shape).map(|s| s + suffix)
112112
}
113-
ast::StmtKind::MacCall(..) | ast::StmtKind::Item(..) | ast::StmtKind::Empty => None,
113+
ast::StmtKind::MacCall(..) | ast::StmtKind::Item(..) | ast::StmtKind::Empty { id: _ } => None,
114114
};
115115
result.and_then(|res| recover_comment_removed(res, stmt.span(), context))
116116
}

src/tools/rustfmt/src/visitor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
180180
}
181181
self.format_missing(stmt.span().hi());
182182
}
183-
ast::StmtKind::Empty => (),
183+
ast::StmtKind::Empty { id: _ } => (),
184184
}
185185
}
186186

@@ -955,7 +955,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
955955
let include_next_empty = if stmts.len() > 1 {
956956
matches!(
957957
(&stmts[0].as_ast_node().kind, &stmts[1].as_ast_node().kind),
958-
(ast::StmtKind::Item(_), ast::StmtKind::Empty)
958+
(ast::StmtKind::Item(_), ast::StmtKind::Empty { id: _ })
959959
)
960960
} else {
961961
false

0 commit comments

Comments
 (0)