Skip to content

Commit cdce354

Browse files
committed
update rustc syntax 91.0.0
1 parent edcc7b6 commit cdce354

13 files changed

+54
-54
lines changed

Cargo.lock

+24-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ env_logger = "0.5"
4646
getopts = "0.2"
4747
derive-new = "0.5"
4848
cargo_metadata = "0.5.1"
49-
rustc-ap-syntax = "89.0.0"
49+
rustc-ap-syntax = "91.0.0"
5050

5151
[dev-dependencies]
5252
lazy_static = "1.0.0"

src/attr.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ fn allow_mixed_tactic_for_nested_metaitem_list(list: &[ast::NestedMetaItem]) ->
200200
impl Rewrite for ast::MetaItem {
201201
fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
202202
Some(match self.node {
203-
ast::MetaItemKind::Word => String::from(&*self.name.as_str()),
203+
ast::MetaItemKind::Word => String::from(&*self.ident.name.as_str()),
204204
ast::MetaItemKind::List(ref list) => {
205-
let name = self.name.as_str();
205+
let name = self.ident.name.as_str();
206206
let item_shape = match context.config.indent_style() {
207207
IndentStyle::Block => shape
208208
.block_indent(context.config.tab_spaces())
@@ -259,7 +259,7 @@ impl Rewrite for ast::MetaItem {
259259
}
260260
}
261261
ast::MetaItemKind::NameValue(ref literal) => {
262-
let name = self.name.as_str();
262+
let name = self.ident.name.as_str();
263263
// 3 = ` = `
264264
let lit_shape = shape.shrink_left(name.len() + 3)?;
265265
// `rewrite_literal` returns `None` when `literal` exceeds max

src/chains.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,9 @@ fn rewrite_chain_subexpr(
438438
},
439439
_ => &[],
440440
};
441-
rewrite_method_call(segment.identifier, types, expressions, span, context, shape)
441+
rewrite_method_call(segment.ident, types, expressions, span, context, shape)
442442
}
443-
ast::ExprKind::Field(_, ref field) => rewrite_element(format!(".{}", field.node)),
443+
ast::ExprKind::Field(_, ref field) => rewrite_element(format!(".{}", field.name)),
444444
ast::ExprKind::TupField(ref expr, ref field) => {
445445
let space = match expr.node {
446446
ast::ExprKind::TupField(..) => " ",

src/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ impl<'a> ControlFlow<'a> {
928928

929929
// `for event in event`
930930
// Do not include label in the span.
931-
let lo = self.label.map_or(self.span.lo(), |label| label.span.hi());
931+
let lo = self.label.map_or(self.span.lo(), |label| label.ident.span.hi());
932932
let between_kwd_cond = mk_sp(
933933
context
934934
.snippet_provider
@@ -1702,7 +1702,7 @@ pub fn rewrite_field(
17021702
if !attrs_str.is_empty() {
17031703
attrs_str.push_str(&shape.indent.to_string_with_newline(context.config));
17041704
};
1705-
let name = field.ident.node.to_string();
1705+
let name = &field.ident.name.to_string();
17061706
if field.is_shorthand {
17071707
Some(attrs_str + &name)
17081708
} else {

src/imports.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use std::borrow::Cow;
2828
/// Returns a name imported by a `use` declaration. e.g. returns `Ordering`
2929
/// for `std::cmp::Ordering` and `self` for `std::cmp::self`.
3030
pub fn path_to_imported_ident(path: &ast::Path) -> ast::Ident {
31-
path.segments.last().unwrap().identifier
31+
path.segments.last().unwrap().ident
3232
}
3333

3434
impl<'a> FmtVisitor<'a> {
@@ -129,7 +129,7 @@ impl UseSegment {
129129
}
130130

131131
fn from_path_segment(path_seg: &ast::PathSegment) -> Option<UseSegment> {
132-
let name = path_seg.identifier.name.as_str();
132+
let name = path_seg.ident.name.as_str();
133133
if name == "{{root}}" {
134134
return None;
135135
}

src/items.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -562,10 +562,10 @@ impl<'a> FmtVisitor<'a> {
562562
)?,
563563
ast::VariantData::Unit(..) => {
564564
if let Some(ref expr) = field.node.disr_expr {
565-
let lhs = format!("{} =", field.node.name);
565+
let lhs = format!("{} =", field.node.ident.name);
566566
rewrite_assign_rhs(&context, lhs, &**expr, shape)?
567567
} else {
568-
field.node.name.to_string()
568+
field.node.ident.name.to_string()
569569
}
570570
}
571571
};
@@ -893,7 +893,7 @@ impl<'a> StructParts<'a> {
893893
fn from_variant(variant: &'a ast::Variant) -> Self {
894894
StructParts {
895895
prefix: "",
896-
ident: variant.node.name,
896+
ident: variant.node.ident,
897897
vis: &DEFAULT_VISIBILITY,
898898
def: &variant.node.data,
899899
generics: None,
@@ -1794,7 +1794,7 @@ pub fn span_hi_for_arg(context: &RewriteContext, arg: &ast::Arg) -> BytePos {
17941794

17951795
pub fn is_named_arg(arg: &ast::Arg) -> bool {
17961796
if let ast::PatKind::Ident(_, ident, _) = arg.pat.node {
1797-
ident.node != symbol::keywords::Invalid.ident()
1797+
ident != symbol::keywords::Invalid.ident()
17981798
} else {
17991799
true
18001800
}
@@ -2263,7 +2263,7 @@ fn rewrite_args(
22632263

22642264
fn arg_has_pattern(arg: &ast::Arg) -> bool {
22652265
if let ast::PatKind::Ident(_, ident, _) = arg.pat.node {
2266-
ident.node != symbol::keywords::Invalid.ident()
2266+
ident != symbol::keywords::Invalid.ident()
22672267
} else {
22682268
true
22692269
}

src/macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fn parse_macro_arg(parser: &mut Parser) -> Option<MacroArg> {
117117
fn rewrite_macro_name(path: &ast::Path, extra_ident: Option<ast::Ident>) -> String {
118118
let name = if path.segments.len() == 1 {
119119
// Avoid using pretty-printer in the common case.
120-
format!("{}!", path.segments[0].identifier)
120+
format!("{}!", path.segments[0].ident)
121121
} else {
122122
format!("{}!", path)
123123
};

src/patterns.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl Rewrite for Pat {
7171
BindingMode::ByValue(mutability) => ("", mutability),
7272
};
7373
let mut_infix = format_mutability(mutability);
74-
let id_str = ident.node.to_string();
74+
let id_str = ident.name.to_string();
7575
let sub_pat = match *sub_pat {
7676
Some(ref p) => {
7777
// 3 - ` @ `.

src/spanned.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ impl Spanned for ast::TyParam {
146146
fn span(&self) -> Span {
147147
// Note that ty.span is the span for ty.ident, not the whole item.
148148
let lo = if self.attrs.is_empty() {
149-
self.span.lo()
149+
self.ident.span.lo()
150150
} else {
151151
self.attrs[0].span.lo()
152152
};
153153
if let Some(ref def) = self.default {
154154
return mk_sp(lo, def.span.hi());
155155
}
156156
if self.bounds.is_empty() {
157-
return mk_sp(lo, self.span.hi());
157+
return mk_sp(lo, self.ident.span.hi());
158158
}
159159
let hi = self.bounds[self.bounds.len() - 1].span().hi();
160160
mk_sp(lo, hi)
@@ -165,19 +165,19 @@ impl Spanned for ast::TyParamBound {
165165
fn span(&self) -> Span {
166166
match *self {
167167
ast::TyParamBound::TraitTyParamBound(ref ptr, _) => ptr.span,
168-
ast::TyParamBound::RegionTyParamBound(ref l) => l.span,
168+
ast::TyParamBound::RegionTyParamBound(ref l) => l.ident.span,
169169
}
170170
}
171171
}
172172

173173
impl Spanned for ast::LifetimeDef {
174174
fn span(&self) -> Span {
175175
let hi = if self.bounds.is_empty() {
176-
self.lifetime.span.hi()
176+
self.lifetime.ident.span.hi()
177177
} else {
178-
self.bounds[self.bounds.len() - 1].span.hi()
178+
self.bounds[self.bounds.len() - 1].ident.span.hi()
179179
};
180-
mk_sp(self.lifetime.span.lo(), hi)
180+
mk_sp(self.lifetime.ident.span.lo(), hi)
181181
}
182182
}
183183

src/types.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ where
119119

120120
for segment in iter {
121121
// Indicates a global path, shouldn't be rendered.
122-
if segment.identifier.name == keywords::CrateRoot.name() {
122+
if segment.ident.name == keywords::CrateRoot.name() {
123123
continue;
124124
}
125125
if first {
@@ -155,7 +155,7 @@ enum SegmentParam<'a> {
155155
impl<'a> Spanned for SegmentParam<'a> {
156156
fn span(&self) -> Span {
157157
match *self {
158-
SegmentParam::LifeTime(lt) => lt.span,
158+
SegmentParam::LifeTime(lt) => lt.ident.span,
159159
SegmentParam::Type(ty) => ty.span,
160160
SegmentParam::Binding(binding) => binding.span,
161161
}
@@ -215,7 +215,7 @@ fn rewrite_segment(
215215
shape: Shape,
216216
) -> Option<String> {
217217
let mut result = String::with_capacity(128);
218-
result.push_str(&segment.identifier.name.as_str());
218+
result.push_str(&segment.ident.name.as_str());
219219

220220
let ident_len = result.len();
221221
let shape = if context.use_block_indent() {

src/utils.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn format_visibility(vis: &Visibility) -> Cow<'static, str> {
4242
VisibilityKind::Crate(CrateSugar::JustCrate) => Cow::from("crate "),
4343
VisibilityKind::Restricted { ref path, .. } => {
4444
let Path { ref segments, .. } = **path;
45-
let mut segments_iter = segments.iter().map(|seg| seg.identifier.name.to_string());
45+
let mut segments_iter = segments.iter().map(|seg| seg.ident.name.to_string());
4646
if path.is_global() {
4747
segments_iter
4848
.next()
@@ -190,9 +190,9 @@ pub fn last_line_extendable(s: &str) -> bool {
190190
#[inline]
191191
fn is_skip(meta_item: &MetaItem) -> bool {
192192
match meta_item.node {
193-
MetaItemKind::Word => meta_item.name == SKIP_ANNOTATION,
193+
MetaItemKind::Word => meta_item.ident.name == SKIP_ANNOTATION,
194194
MetaItemKind::List(ref l) => {
195-
meta_item.name == "cfg_attr" && l.len() == 2 && is_skip_nested(&l[1])
195+
meta_item.ident.name == "cfg_attr" && l.len() == 2 && is_skip_nested(&l[1])
196196
}
197197
_ => false,
198198
}

src/vertical.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl AlignedItem for ast::Field {
8888

8989
fn rewrite_prefix(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
9090
let attrs_str = self.attrs.rewrite(context, shape)?;
91-
let name = &self.ident.node.to_string();
91+
let name = &self.ident.name.to_string();
9292
let missing_span = if self.attrs.is_empty() {
9393
mk_sp(self.span.lo(), self.span.lo())
9494
} else {

0 commit comments

Comments
 (0)