Fix clippy and rustfmt compilation

This commit is contained in:
Eric Holk 2024-09-20 15:44:43 -07:00
parent ae698f8199
commit b490bf56b7
No known key found for this signature in database
GPG Key ID: F1A772BB658A63E1
3 changed files with 34 additions and 33 deletions

View File

@ -2,7 +2,10 @@
use rustc_ast::token::{self, BinOpToken, Delimiter, IdentIsRaw, Token, TokenKind};
use rustc_ast::util::case::Case;
use rustc_ast::{
self as ast, BareFnTy, BoundAsyncness, BoundConstness, BoundPolarity, FnRetTy, GenericBound, GenericBounds, GenericParam, Generics, Lifetime, MacCall, MutTy, Mutability, Pinnedness, PolyTraitRef, PreciseCapturingArg, TraitBoundModifiers, TraitObjectSyntax, Ty, TyKind, DUMMY_NODE_ID
self as ast, BareFnTy, BoundAsyncness, BoundConstness, BoundPolarity, DUMMY_NODE_ID, FnRetTy,
GenericBound, GenericBounds, GenericParam, Generics, Lifetime, MacCall, MutTy, Mutability,
Pinnedness, PolyTraitRef, PreciseCapturingArg, TraitBoundModifiers, TraitObjectSyntax, Ty,
TyKind,
};
use rustc_errors::{Applicability, PResult};
use rustc_span::symbol::{Ident, kw, sym};

View File

@ -574,9 +574,7 @@ fn visit_expr(&mut self, e: &'v ast::Expr) {
}
fn visit_ty(&mut self, t: &'v ast::Ty) {
record_variants!(
(self, t, t.kind, Id::None, ast, Ty, TyKind),
[
record_variants!((self, t, t.kind, Id::None, ast, Ty, TyKind), [
Slice,
Array,
Ptr,
@ -599,8 +597,7 @@ fn visit_ty(&mut self, t: &'v ast::Ty) {
CVarArgs,
Dummy,
Err
]
);
]);
ast_visit::walk_ty(self, t)
}

View File

@ -827,8 +827,9 @@ fn rewrite_result(&self, context: &RewriteContext<'_>, shape: Shape) -> RewriteR
rewrite_unary_prefix(context, prefix, &*mt.ty, shape)
}
ast::TyKind::Ref(ref lifetime, _pinned, ref mt) => {
// FIXME: format pinnedness
ast::TyKind::Ref(ref lifetime, ref mt)
| ast::TyKind::PinnedRef(ref lifetime, ref mt) => {
// FIXME(pin_ergonomics): correctly format pinned reference syntax
let mut_str = format_mutability(mt.mutbl);
let mut_len = mut_str.len();
let mut result = String::with_capacity(128);
@ -1263,9 +1264,9 @@ pub(crate) fn can_be_overflowed_type(
) -> bool {
match ty.kind {
ast::TyKind::Tup(..) => context.use_block_indent() && len == 1,
ast::TyKind::Ref(_, _, ref mutty) | ast::TyKind::Ptr(ref mutty) => {
can_be_overflowed_type(context, &*mutty.ty, len)
}
ast::TyKind::Ref(_, ref mutty)
| ast::TyKind::PinnedRef(_, ref mutty)
| ast::TyKind::Ptr(ref mutty) => can_be_overflowed_type(context, &*mutty.ty, len),
_ => false,
}
}