From fe0415e17a6cda89ab7a8afa3cfe1dfc298e3ded Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 14 Mar 2024 11:25:05 +0100 Subject: [PATCH] Rename `ast::StmtKind::Local` into `ast::StmtKind::Let` --- src/attr.rs | 2 +- src/spanned.rs | 2 +- src/stmt.rs | 2 +- src/visitor.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/attr.rs b/src/attr.rs index 4d83547d664..83f59837d44 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -26,7 +26,7 @@ pub(crate) fn get_attrs_from_stmt(stmt: &ast::Stmt) -> &[ast::Attribute] { pub(crate) fn get_span_without_attrs(stmt: &ast::Stmt) -> Span { match stmt.kind { - ast::StmtKind::Local(ref local) => local.span, + ast::StmtKind::Let(ref local) => local.span, ast::StmtKind::Item(ref item) => item.span, ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => expr.span, ast::StmtKind::MacCall(ref mac_stmt) => mac_stmt.mac.span(), diff --git a/src/spanned.rs b/src/spanned.rs index 5960b144499..4aaf7fdb27f 100644 --- a/src/spanned.rs +++ b/src/spanned.rs @@ -61,7 +61,7 @@ fn span(&self) -> Span { impl Spanned for ast::Stmt { fn span(&self) -> Span { match self.kind { - ast::StmtKind::Local(ref local) => mk_sp(local.span().lo(), self.span.hi()), + ast::StmtKind::Let(ref local) => mk_sp(local.span().lo(), self.span.hi()), ast::StmtKind::Item(ref item) => mk_sp(item.span().lo(), self.span.hi()), ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => { mk_sp(expr.span().lo(), self.span.hi()) diff --git a/src/stmt.rs b/src/stmt.rs index e3fe4ebca11..73a9cce416c 100644 --- a/src/stmt.rs +++ b/src/stmt.rs @@ -115,7 +115,7 @@ fn format_stmt( skip_out_of_file_lines_range!(context, stmt.span()); let result = match stmt.kind { - ast::StmtKind::Local(ref local) => local.rewrite(context, shape), + ast::StmtKind::Let(ref local) => local.rewrite(context, shape), ast::StmtKind::Expr(ref ex) | ast::StmtKind::Semi(ref ex) => { let suffix = if semicolon_for_stmt(context, stmt, is_last_expr) { ";" diff --git a/src/visitor.rs b/src/visitor.rs index 47f772b485d..6209b37004b 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -150,7 +150,7 @@ fn visit_stmt(&mut self, stmt: &Stmt<'_>, include_empty_semi: bool) { self.visit_item(item); self.last_pos = stmt.span().hi(); } - ast::StmtKind::Local(..) | ast::StmtKind::Expr(..) | ast::StmtKind::Semi(..) => { + ast::StmtKind::Let(..) | ast::StmtKind::Expr(..) | ast::StmtKind::Semi(..) => { let attrs = get_attrs_from_stmt(stmt.as_ast_node()); if contains_skip(attrs) { self.push_skipped_with_span(