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::token::{self, BinOpToken, Delimiter, IdentIsRaw, Token, TokenKind};
use rustc_ast::util::case::Case; use rustc_ast::util::case::Case;
use rustc_ast::{ 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_errors::{Applicability, PResult};
use rustc_span::symbol::{Ident, kw, sym}; use rustc_span::symbol::{Ident, kw, sym};

View File

@ -574,33 +574,30 @@ fn visit_expr(&mut self, e: &'v ast::Expr) {
} }
fn visit_ty(&mut self, t: &'v ast::Ty) { fn visit_ty(&mut self, t: &'v ast::Ty) {
record_variants!( record_variants!((self, t, t.kind, Id::None, ast, Ty, TyKind), [
(self, t, t.kind, Id::None, ast, Ty, TyKind), Slice,
[ Array,
Slice, Ptr,
Array, Ref,
Ptr, PinnedRef,
Ref, BareFn,
PinnedRef, Never,
BareFn, Tup,
Never, AnonStruct,
Tup, AnonUnion,
AnonStruct, Path,
AnonUnion, Pat,
Path, TraitObject,
Pat, ImplTrait,
TraitObject, Paren,
ImplTrait, Typeof,
Paren, Infer,
Typeof, ImplicitSelf,
Infer, MacCall,
ImplicitSelf, CVarArgs,
MacCall, Dummy,
CVarArgs, Err
Dummy, ]);
Err
]
);
ast_visit::walk_ty(self, t) 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) rewrite_unary_prefix(context, prefix, &*mt.ty, shape)
} }
ast::TyKind::Ref(ref lifetime, _pinned, ref mt) => { ast::TyKind::Ref(ref lifetime, ref mt)
// FIXME: format pinnedness | ast::TyKind::PinnedRef(ref lifetime, ref mt) => {
// FIXME(pin_ergonomics): correctly format pinned reference syntax
let mut_str = format_mutability(mt.mutbl); let mut_str = format_mutability(mt.mutbl);
let mut_len = mut_str.len(); let mut_len = mut_str.len();
let mut result = String::with_capacity(128); let mut result = String::with_capacity(128);
@ -1263,9 +1264,9 @@ pub(crate) fn can_be_overflowed_type(
) -> bool { ) -> bool {
match ty.kind { match ty.kind {
ast::TyKind::Tup(..) => context.use_block_indent() && len == 1, ast::TyKind::Tup(..) => context.use_block_indent() && len == 1,
ast::TyKind::Ref(_, _, ref mutty) | ast::TyKind::Ptr(ref mutty) => { ast::TyKind::Ref(_, ref mutty)
can_be_overflowed_type(context, &*mutty.ty, len) | ast::TyKind::PinnedRef(_, ref mutty)
} | ast::TyKind::Ptr(ref mutty) => can_be_overflowed_type(context, &*mutty.ty, len),
_ => false, _ => false,
} }
} }