Skip to content

Commit b490bf5

Browse files
committed
Fix clippy and rustfmt compilation
1 parent ae698f8 commit b490bf5

File tree

3 files changed

+34
-33
lines changed

3 files changed

+34
-33
lines changed

Diff for: compiler/rustc_parse/src/parser/ty.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ use rustc_ast::ptr::P;
22
use rustc_ast::token::{self, BinOpToken, Delimiter, IdentIsRaw, Token, TokenKind};
33
use rustc_ast::util::case::Case;
44
use rustc_ast::{
5-
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
5+
self as ast, BareFnTy, BoundAsyncness, BoundConstness, BoundPolarity, DUMMY_NODE_ID, FnRetTy,
6+
GenericBound, GenericBounds, GenericParam, Generics, Lifetime, MacCall, MutTy, Mutability,
7+
Pinnedness, PolyTraitRef, PreciseCapturingArg, TraitBoundModifiers, TraitObjectSyntax, Ty,
8+
TyKind,
69
};
710
use rustc_errors::{Applicability, PResult};
811
use rustc_span::symbol::{Ident, kw, sym};

Diff for: compiler/rustc_passes/src/hir_stats.rs

+24-27
Original file line numberDiff line numberDiff line change
@@ -574,33 +574,30 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
574574
}
575575

576576
fn visit_ty(&mut self, t: &'v ast::Ty) {
577-
record_variants!(
578-
(self, t, t.kind, Id::None, ast, Ty, TyKind),
579-
[
580-
Slice,
581-
Array,
582-
Ptr,
583-
Ref,
584-
PinnedRef,
585-
BareFn,
586-
Never,
587-
Tup,
588-
AnonStruct,
589-
AnonUnion,
590-
Path,
591-
Pat,
592-
TraitObject,
593-
ImplTrait,
594-
Paren,
595-
Typeof,
596-
Infer,
597-
ImplicitSelf,
598-
MacCall,
599-
CVarArgs,
600-
Dummy,
601-
Err
602-
]
603-
);
577+
record_variants!((self, t, t.kind, Id::None, ast, Ty, TyKind), [
578+
Slice,
579+
Array,
580+
Ptr,
581+
Ref,
582+
PinnedRef,
583+
BareFn,
584+
Never,
585+
Tup,
586+
AnonStruct,
587+
AnonUnion,
588+
Path,
589+
Pat,
590+
TraitObject,
591+
ImplTrait,
592+
Paren,
593+
Typeof,
594+
Infer,
595+
ImplicitSelf,
596+
MacCall,
597+
CVarArgs,
598+
Dummy,
599+
Err
600+
]);
604601

605602
ast_visit::walk_ty(self, t)
606603
}

Diff for: src/tools/rustfmt/src/types.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -827,8 +827,9 @@ impl Rewrite for ast::Ty {
827827

828828
rewrite_unary_prefix(context, prefix, &*mt.ty, shape)
829829
}
830-
ast::TyKind::Ref(ref lifetime, _pinned, ref mt) => {
831-
// FIXME: format pinnedness
830+
ast::TyKind::Ref(ref lifetime, ref mt)
831+
| ast::TyKind::PinnedRef(ref lifetime, ref mt) => {
832+
// FIXME(pin_ergonomics): correctly format pinned reference syntax
832833
let mut_str = format_mutability(mt.mutbl);
833834
let mut_len = mut_str.len();
834835
let mut result = String::with_capacity(128);
@@ -1263,9 +1264,9 @@ pub(crate) fn can_be_overflowed_type(
12631264
) -> bool {
12641265
match ty.kind {
12651266
ast::TyKind::Tup(..) => context.use_block_indent() && len == 1,
1266-
ast::TyKind::Ref(_, _, ref mutty) | ast::TyKind::Ptr(ref mutty) => {
1267-
can_be_overflowed_type(context, &*mutty.ty, len)
1268-
}
1267+
ast::TyKind::Ref(_, ref mutty)
1268+
| ast::TyKind::PinnedRef(_, ref mutty)
1269+
| ast::TyKind::Ptr(ref mutty) => can_be_overflowed_type(context, &*mutty.ty, len),
12691270
_ => false,
12701271
}
12711272
}

0 commit comments

Comments
 (0)