Skip to content

Commit d1b61a3

Browse files
committed
Inline and remove MetaItemLit::from_lit_kind.
It has a single call site.
1 parent ac7a749 commit d1b61a3

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

compiler/rustc_ast/src/attr/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ pub fn mk_name_value_item_str(ident: Ident, str: Symbol, str_span: Span) -> Meta
333333
mk_name_value_item(ident, lit_kind, str_span)
334334
}
335335

336-
pub fn mk_name_value_item(ident: Ident, lit_kind: LitKind, lit_span: Span) -> MetaItem {
337-
let lit = MetaItemLit::from_lit_kind(lit_kind, lit_span);
336+
pub fn mk_name_value_item(ident: Ident, kind: LitKind, lit_span: Span) -> MetaItem {
337+
let lit = MetaItemLit { token_lit: kind.to_token_lit(), kind, span: lit_span };
338338
let span = ident.span.to(lit_span);
339339
MetaItem { path: Path::from_ident(ident), span, kind: MetaItemKind::NameValue(lit) }
340340
}

compiler/rustc_ast/src/util/literal.rs

-7
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,6 @@ impl MetaItemLit {
207207
.and_then(|token_lit| MetaItemLit::from_token_lit(token_lit, token.span).ok())
208208
}
209209

210-
/// Attempts to create a meta item literal from a `LitKind`.
211-
/// This function is used when the original token doesn't exist (e.g. the literal is created
212-
/// by an AST-based macro) or unavailable (e.g. from HIR pretty-printing).
213-
pub fn from_lit_kind(kind: LitKind, span: Span) -> MetaItemLit {
214-
MetaItemLit { token_lit: kind.to_token_lit(), kind, span }
215-
}
216-
217210
/// Losslessly convert a meta item literal into a token.
218211
pub fn to_token(&self) -> Token {
219212
let kind = match self.token_lit.kind {

0 commit comments

Comments
 (0)