Skip to content

Commit a289b83

Browse files
Fix rustfmt
1 parent ff8e9a0 commit a289b83

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/tools/rustfmt/src/spanned.rs

Lines changed: 1 addition & 0 deletions
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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ 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+
ast::GenericBound::Use(..) => None,
566567
}
567568
}
568569
}
@@ -843,11 +844,7 @@ impl Rewrite for ast::Ty {
843844
rewrite_macro(mac, None, context, shape, MacroPosition::Expression)
844845
}
845846
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-
}
847+
ast::TyKind::ImplTrait(_, ref it) => {
851848
// Empty trait is not a parser error.
852849
if it.is_empty() {
853850
return Some("impl".to_owned());
@@ -930,7 +927,7 @@ fn rewrite_bare_fn(
930927

931928
fn is_generic_bounds_in_order(generic_bounds: &[ast::GenericBound]) -> bool {
932929
let is_trait = |b: &ast::GenericBound| match b {
933-
ast::GenericBound::Outlives(..) => false,
930+
ast::GenericBound::Outlives(..) | ast::GenericBound::Use(..) => false,
934931
ast::GenericBound::Trait(..) => true,
935932
};
936933
let is_lifetime = |b: &ast::GenericBound| !is_trait(b);
@@ -964,7 +961,7 @@ fn join_bounds_inner(
964961

965962
let generic_bounds_in_order = is_generic_bounds_in_order(items);
966963
let is_bound_extendable = |s: &str, b: &ast::GenericBound| match b {
967-
ast::GenericBound::Outlives(..) => true,
964+
ast::GenericBound::Outlives(..) | ast::GenericBound::Use(..) => true,
968965
ast::GenericBound::Trait(..) => last_line_extendable(s),
969966
};
970967

@@ -1110,8 +1107,7 @@ fn join_bounds_inner(
11101107

11111108
pub(crate) fn opaque_ty(ty: &Option<ptr::P<ast::Ty>>) -> Option<&ast::GenericBounds> {
11121109
ty.as_ref().and_then(|t| match &t.kind {
1113-
// FIXME(precise_capturing): Implement support here
1114-
ast::TyKind::ImplTrait(_, bounds, _) => Some(bounds),
1110+
ast::TyKind::ImplTrait(_, bounds) => Some(bounds),
11151111
_ => None,
11161112
})
11171113
}

0 commit comments

Comments
 (0)