Skip to content

Commit 7fe6bc5

Browse files
committed
Use clone to clone DelimArgs in two places.
1 parent d88056c commit 7fe6bc5

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
916916
}
917917

918918
fn lower_delim_args(&self, args: &DelimArgs) -> DelimArgs {
919-
DelimArgs { dspan: args.dspan, delim: args.delim, tokens: args.tokens.clone() }
919+
args.clone()
920920
}
921921

922922
/// Lower an associated item constraint.

compiler/rustc_attr_parsing/src/context.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::collections::BTreeMap;
33
use std::ops::Deref;
44
use std::sync::LazyLock;
55

6-
use rustc_ast::{self as ast, DelimArgs};
6+
use rustc_ast as ast;
77
use rustc_attr_data_structures::AttributeKind;
88
use rustc_errors::{DiagCtxtHandle, Diagnostic};
99
use rustc_feature::Features;
@@ -315,11 +315,7 @@ impl<'sess> AttributeParser<'sess> {
315315
fn lower_attr_args(&self, args: &ast::AttrArgs, lower_span: impl Fn(Span) -> Span) -> AttrArgs {
316316
match args {
317317
ast::AttrArgs::Empty => AttrArgs::Empty,
318-
ast::AttrArgs::Delimited(args) => AttrArgs::Delimited(DelimArgs {
319-
dspan: args.dspan,
320-
delim: args.delim,
321-
tokens: args.tokens.clone(),
322-
}),
318+
ast::AttrArgs::Delimited(args) => AttrArgs::Delimited(args.clone()),
323319
// This is an inert key-value attribute - it will never be visible to macros
324320
// after it gets lowered to HIR. Therefore, we can extract literals to handle
325321
// nonterminals in `#[doc]` (e.g. `#[doc = $e]`).

0 commit comments

Comments
 (0)