Skip to content

Commit bd83649

Browse files
Fix rustfmt
1 parent 2e03130 commit bd83649

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/tools/rustfmt/src/spanned.rs

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ impl Spanned for ast::GenericBound {
181181
match *self {
182182
ast::GenericBound::Trait(ref ptr, _) => ptr.span,
183183
ast::GenericBound::Outlives(ref l) => l.ident.span,
184+
ast::GenericBound::Use(_, span) => span,
184185
}
185186
}
186187
}

src/tools/rustfmt/src/types.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,8 @@ impl Rewrite for ast::GenericBound {
563563
.map(|s| if has_paren { format!("({})", s) } else { s })
564564
}
565565
ast::GenericBound::Outlives(ref lifetime) => lifetime.rewrite(context, shape),
566+
// FIXME(precise_capturing): Should implement formatting before stabilization.
567+
ast::GenericBound::Use(..) => None,
566568
}
567569
}
568570
}
@@ -843,11 +845,7 @@ impl Rewrite for ast::Ty {
843845
rewrite_macro(mac, None, context, shape, MacroPosition::Expression)
844846
}
845847
ast::TyKind::ImplicitSelf => Some(String::from("")),
846-
ast::TyKind::ImplTrait(_, ref it, ref captures) => {
847-
// FIXME(precise_capturing): Implement formatting.
848-
if captures.is_some() {
849-
return None;
850-
}
848+
ast::TyKind::ImplTrait(_, ref it) => {
851849
// Empty trait is not a parser error.
852850
if it.is_empty() {
853851
return Some("impl".to_owned());
@@ -932,6 +930,8 @@ fn is_generic_bounds_in_order(generic_bounds: &[ast::GenericBound]) -> bool {
932930
let is_trait = |b: &ast::GenericBound| match b {
933931
ast::GenericBound::Outlives(..) => false,
934932
ast::GenericBound::Trait(..) => true,
933+
// FIXME(precise_capturing): This ordering fn should be reworked.
934+
ast::GenericBound::Use(..) => false,
935935
};
936936
let is_lifetime = |b: &ast::GenericBound| !is_trait(b);
937937
let last_trait_index = generic_bounds.iter().rposition(is_trait);
@@ -966,6 +966,8 @@ fn join_bounds_inner(
966966
let is_bound_extendable = |s: &str, b: &ast::GenericBound| match b {
967967
ast::GenericBound::Outlives(..) => true,
968968
ast::GenericBound::Trait(..) => last_line_extendable(s),
969+
// FIXME(precise_capturing): This ordering fn should be reworked.
970+
ast::GenericBound::Use(..) => true,
969971
};
970972

971973
// Whether a GenericBound item is a PathSegment segment that includes internal array
@@ -1110,8 +1112,7 @@ fn join_bounds_inner(
11101112

11111113
pub(crate) fn opaque_ty(ty: &Option<ptr::P<ast::Ty>>) -> Option<&ast::GenericBounds> {
11121114
ty.as_ref().and_then(|t| match &t.kind {
1113-
// FIXME(precise_capturing): Implement support here
1114-
ast::TyKind::ImplTrait(_, bounds, _) => Some(bounds),
1115+
ast::TyKind::ImplTrait(_, bounds) => Some(bounds),
11151116
_ => None,
11161117
})
11171118
}

0 commit comments

Comments
 (0)