Skip to content

Commit 7374ae7

Browse files
committed
x.py fmt
1 parent 97d388a commit 7374ae7

File tree

18 files changed

+134
-34
lines changed

18 files changed

+134
-34
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,7 +1900,7 @@ pub struct BareFnTy {
19001900
pub ext: Extern,
19011901
pub generic_params: Vec<GenericParam>,
19021902
pub decl: P<FnDecl>,
1903-
pub constness: Const
1903+
pub constness: Const,
19041904
}
19051905

19061906
/// The various kinds of type recognized by the compiler.

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,8 @@ pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
462462
vis.visit_mt(mt);
463463
}
464464
TyKind::BareFn(bft) => {
465-
let BareFnTy { unsafety: _, ext: _, constness: _, generic_params, decl } = bft.deref_mut();
465+
let BareFnTy { unsafety: _, ext: _, constness: _, generic_params, decl } =
466+
bft.deref_mut();
466467
generic_params.flat_map_in_place(|param| vis.flat_map_generic_param(param));
467468
vis.visit_fn_decl(decl);
468469
}

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ use rustc_errors::{error_code, pluralize, struct_span_err, Applicability};
1717
use rustc_parse::validate_attr;
1818
use rustc_session::lint::builtin::PATTERNS_IN_FNS_WITHOUT_BODY;
1919
use rustc_session::lint::LintBuffer;
20+
use rustc_session::parse::feature_err;
2021
use rustc_session::Session;
2122
use rustc_span::symbol::{kw, sym, Ident};
2223
use rustc_span::Span;
2324
use std::mem;
2425
use std::ops::DerefMut;
25-
use rustc_session::parse::feature_err;
2626

2727
const MORE_EXTERN: &str =
2828
"for more information, visit https://doc.rust-lang.org/std/keyword.extern.html";
@@ -831,8 +831,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
831831
&self.session.parse_sess,
832832
sym::const_fn_pointer,
833833
span,
834-
"`const fn` pointer type is unstable"
835-
).emit()
834+
"`const fn` pointer type is unstable",
835+
)
836+
.emit()
836837
}
837838
}
838839
self.check_late_bound_lifetime_defs(&bfty.generic_params);

compiler/rustc_hir/src/hir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,7 +2035,7 @@ pub struct BareFnTy<'hir> {
20352035
pub generic_params: &'hir [GenericParam<'hir>],
20362036
pub decl: &'hir FnDecl<'hir>,
20372037
pub param_names: &'hir [Ident],
2038-
pub constness: Constness
2038+
pub constness: Constness,
20392039
}
20402040

20412041
#[derive(Debug, HashStable_Generic)]
@@ -2522,7 +2522,7 @@ impl fmt::Display for Constness {
25222522
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25232523
f.write_str(match *self {
25242524
Self::Const => "const",
2525-
Self::NotConst => ""
2525+
Self::NotConst => "",
25262526
})
25272527
}
25282528
}

compiler/rustc_hir_pretty/src/lib.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,12 +2329,7 @@ impl<'a> State<'a> {
23292329
};
23302330
self.print_fn(
23312331
decl,
2332-
hir::FnHeader {
2333-
unsafety,
2334-
abi,
2335-
constness,
2336-
asyncness: hir::IsAsync::NotAsync,
2337-
},
2332+
hir::FnHeader { unsafety, abi, constness, asyncness: hir::IsAsync::NotAsync },
23382333
name,
23392334
&generics,
23402335
&Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Inherited },

compiler/rustc_middle/src/ty/context.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,7 +2082,14 @@ impl<'tcx> TyCtxt<'tcx> {
20822082
ty::Tuple(params) => params.into_iter().map(|k| k.expect_ty()),
20832083
_ => bug!(),
20842084
};
2085-
self.mk_fn_sig(params_iter, s.output(), s.c_variadic, unsafety, abi::Abi::Rust, hir::Constness::NotConst,)
2085+
self.mk_fn_sig(
2086+
params_iter,
2087+
s.output(),
2088+
s.c_variadic,
2089+
unsafety,
2090+
abi::Abi::Rust,
2091+
hir::Constness::NotConst,
2092+
)
20862093
})
20872094
}
20882095

@@ -2469,7 +2476,7 @@ impl<'tcx> TyCtxt<'tcx> {
24692476
c_variadic,
24702477
unsafety,
24712478
abi,
2472-
constness
2479+
constness,
24732480
})
24742481
}
24752482

compiler/rustc_middle/src/ty/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ impl<'tcx> TypeError<'tcx> {
201201
pub fn must_include_note(&self) -> bool {
202202
use self::TypeError::*;
203203
match self {
204-
CyclicTy(_) | CyclicConst(_) | UnsafetyMismatch(_) | Mismatch | AbiMismatch(_) | ConstnessMismatch(_) | FixedArraySize(_)
205-
| Sorts(_) | IntMismatch(_) | FloatMismatch(_) | VariadicMismatch(_)
206-
| TargetFeatureCast(_) => false,
204+
CyclicTy(_) | CyclicConst(_) | UnsafetyMismatch(_) | Mismatch | AbiMismatch(_)
205+
| ConstnessMismatch(_) | FixedArraySize(_) | Sorts(_) | IntMismatch(_)
206+
| FloatMismatch(_) | VariadicMismatch(_) | TargetFeatureCast(_) => false,
207207

208208
Mutability
209209
| TupleSize(_)

compiler/rustc_middle/src/ty/relate.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl<'tcx> Relate<'tcx> for ty::FnSig<'tcx> {
190190
c_variadic: a.c_variadic,
191191
unsafety,
192192
abi,
193-
constness
193+
constness,
194194
})
195195
}
196196
}
@@ -223,10 +223,13 @@ impl<'tcx> Relate<'tcx> for ast::Constness {
223223
fn relate<R: TypeRelation<'tcx>>(
224224
relation: &mut R,
225225
a: ast::Constness,
226-
b: ast::Constness
226+
b: ast::Constness,
227227
) -> RelateResult<'tcx, ast::Constness> {
228-
if a == b || (a == ast::Constness::Const && b == ast::Constness::NotConst) { Ok(b) }
229-
else { Err(TypeError::ConstnessMismatch(expected_found(relation, a, b))) }
228+
if a == b || (a == ast::Constness::Const && b == ast::Constness::NotConst) {
229+
Ok(b)
230+
} else {
231+
Err(TypeError::ConstnessMismatch(expected_found(relation, a, b)))
232+
}
230233
}
231234
}
232235

compiler/rustc_middle/src/ty/structural_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::FnSig<'a> {
648648
c_variadic: self.c_variadic,
649649
unsafety: self.unsafety,
650650
abi: self.abi,
651-
constness: self.constness
651+
constness: self.constness,
652652
})
653653
}
654654
}

compiler/rustc_middle/src/ty/sty.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ pub struct FnSig<'tcx> {
11271127
pub c_variadic: bool,
11281128
pub unsafety: hir::Unsafety,
11291129
pub abi: abi::Abi,
1130-
pub constness: hir::Constness
1130+
pub constness: hir::Constness,
11311131
}
11321132

11331133
impl<'tcx> FnSig<'tcx> {
@@ -1179,7 +1179,9 @@ impl<'tcx> PolyFnSig<'tcx> {
11791179
pub fn abi(&self) -> abi::Abi {
11801180
self.skip_binder().abi
11811181
}
1182-
pub fn constness(&self) -> hir::Constness { self.skip_binder().constness }
1182+
pub fn constness(&self) -> hir::Constness {
1183+
self.skip_binder().constness
1184+
}
11831185
}
11841186

11851187
pub type CanonicalPolyFnSig<'tcx> = Canonical<'tcx, Binder<FnSig<'tcx>>>;

0 commit comments

Comments
 (0)