Fix rustfmt
This commit is contained in:
parent
783a411f67
commit
1d1989fdab
@ -181,6 +181,7 @@ fn span(&self) -> Span {
|
|||||||
match *self {
|
match *self {
|
||||||
ast::GenericBound::Trait(ref ptr, _) => ptr.span,
|
ast::GenericBound::Trait(ref ptr, _) => ptr.span,
|
||||||
ast::GenericBound::Outlives(ref l) => l.ident.span,
|
ast::GenericBound::Outlives(ref l) => l.ident.span,
|
||||||
|
ast::GenericBound::Use(_, span) => span,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
src/types.rs
15
src/types.rs
@ -563,6 +563,8 @@ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String>
|
|||||||
.map(|s| if has_paren { format!("({})", s) } else { s })
|
.map(|s| if has_paren { format!("({})", s) } else { s })
|
||||||
}
|
}
|
||||||
ast::GenericBound::Outlives(ref lifetime) => lifetime.rewrite(context, shape),
|
ast::GenericBound::Outlives(ref lifetime) => lifetime.rewrite(context, shape),
|
||||||
|
// FIXME(precise_capturing): Should implement formatting before stabilization.
|
||||||
|
ast::GenericBound::Use(..) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -843,11 +845,7 @@ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String>
|
|||||||
rewrite_macro(mac, None, context, shape, MacroPosition::Expression)
|
rewrite_macro(mac, None, context, shape, MacroPosition::Expression)
|
||||||
}
|
}
|
||||||
ast::TyKind::ImplicitSelf => Some(String::from("")),
|
ast::TyKind::ImplicitSelf => Some(String::from("")),
|
||||||
ast::TyKind::ImplTrait(_, ref it, ref captures) => {
|
ast::TyKind::ImplTrait(_, ref it) => {
|
||||||
// FIXME(precise_capturing): Implement formatting.
|
|
||||||
if captures.is_some() {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
// Empty trait is not a parser error.
|
// Empty trait is not a parser error.
|
||||||
if it.is_empty() {
|
if it.is_empty() {
|
||||||
return Some("impl".to_owned());
|
return Some("impl".to_owned());
|
||||||
@ -932,6 +930,8 @@ fn is_generic_bounds_in_order(generic_bounds: &[ast::GenericBound]) -> bool {
|
|||||||
let is_trait = |b: &ast::GenericBound| match b {
|
let is_trait = |b: &ast::GenericBound| match b {
|
||||||
ast::GenericBound::Outlives(..) => false,
|
ast::GenericBound::Outlives(..) => false,
|
||||||
ast::GenericBound::Trait(..) => true,
|
ast::GenericBound::Trait(..) => true,
|
||||||
|
// FIXME(precise_capturing): This ordering fn should be reworked.
|
||||||
|
ast::GenericBound::Use(..) => false,
|
||||||
};
|
};
|
||||||
let is_lifetime = |b: &ast::GenericBound| !is_trait(b);
|
let is_lifetime = |b: &ast::GenericBound| !is_trait(b);
|
||||||
let last_trait_index = generic_bounds.iter().rposition(is_trait);
|
let last_trait_index = generic_bounds.iter().rposition(is_trait);
|
||||||
@ -966,6 +966,8 @@ fn join_bounds_inner(
|
|||||||
let is_bound_extendable = |s: &str, b: &ast::GenericBound| match b {
|
let is_bound_extendable = |s: &str, b: &ast::GenericBound| match b {
|
||||||
ast::GenericBound::Outlives(..) => true,
|
ast::GenericBound::Outlives(..) => true,
|
||||||
ast::GenericBound::Trait(..) => last_line_extendable(s),
|
ast::GenericBound::Trait(..) => last_line_extendable(s),
|
||||||
|
// FIXME(precise_capturing): This ordering fn should be reworked.
|
||||||
|
ast::GenericBound::Use(..) => true,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Whether a GenericBound item is a PathSegment segment that includes internal array
|
// Whether a GenericBound item is a PathSegment segment that includes internal array
|
||||||
@ -1110,8 +1112,7 @@ fn join_bounds_inner(
|
|||||||
|
|
||||||
pub(crate) fn opaque_ty(ty: &Option<ptr::P<ast::Ty>>) -> Option<&ast::GenericBounds> {
|
pub(crate) fn opaque_ty(ty: &Option<ptr::P<ast::Ty>>) -> Option<&ast::GenericBounds> {
|
||||||
ty.as_ref().and_then(|t| match &t.kind {
|
ty.as_ref().and_then(|t| match &t.kind {
|
||||||
// FIXME(precise_capturing): Implement support here
|
ast::TyKind::ImplTrait(_, bounds) => Some(bounds),
|
||||||
ast::TyKind::ImplTrait(_, bounds, _) => Some(bounds),
|
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user