mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
Fix clippy and rustfmt compilation
This commit is contained in:
parent
ae698f8199
commit
b490bf56b7
@ -2,7 +2,10 @@ use rustc_ast::ptr::P;
|
||||
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};
|
||||
|
@ -574,33 +574,30 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
|
||||
}
|
||||
|
||||
fn visit_ty(&mut self, t: &'v ast::Ty) {
|
||||
record_variants!(
|
||||
(self, t, t.kind, Id::None, ast, Ty, TyKind),
|
||||
[
|
||||
Slice,
|
||||
Array,
|
||||
Ptr,
|
||||
Ref,
|
||||
PinnedRef,
|
||||
BareFn,
|
||||
Never,
|
||||
Tup,
|
||||
AnonStruct,
|
||||
AnonUnion,
|
||||
Path,
|
||||
Pat,
|
||||
TraitObject,
|
||||
ImplTrait,
|
||||
Paren,
|
||||
Typeof,
|
||||
Infer,
|
||||
ImplicitSelf,
|
||||
MacCall,
|
||||
CVarArgs,
|
||||
Dummy,
|
||||
Err
|
||||
]
|
||||
);
|
||||
record_variants!((self, t, t.kind, Id::None, ast, Ty, TyKind), [
|
||||
Slice,
|
||||
Array,
|
||||
Ptr,
|
||||
Ref,
|
||||
PinnedRef,
|
||||
BareFn,
|
||||
Never,
|
||||
Tup,
|
||||
AnonStruct,
|
||||
AnonUnion,
|
||||
Path,
|
||||
Pat,
|
||||
TraitObject,
|
||||
ImplTrait,
|
||||
Paren,
|
||||
Typeof,
|
||||
Infer,
|
||||
ImplicitSelf,
|
||||
MacCall,
|
||||
CVarArgs,
|
||||
Dummy,
|
||||
Err
|
||||
]);
|
||||
|
||||
ast_visit::walk_ty(self, t)
|
||||
}
|
||||
|
@ -827,8 +827,9 @@ impl Rewrite for ast::Ty {
|
||||
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user