Skip to content

Commit e2939c3

Browse files
Move trait bound modifiers into ast::PolyTraitRef
1 parent ab5afca commit e2939c3

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/spanned.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl Spanned for ast::GenericArg {
180180
impl Spanned for ast::GenericBound {
181181
fn span(&self) -> Span {
182182
match *self {
183-
ast::GenericBound::Trait(ref ptr, _) => ptr.span,
183+
ast::GenericBound::Trait(ref ptr) => ptr.span,
184184
ast::GenericBound::Outlives(ref l) => l.ident.span,
185185
ast::GenericBound::Use(_, span) => span,
186186
}

src/types.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -610,16 +610,14 @@ impl Rewrite for ast::GenericBound {
610610

611611
fn rewrite_result(&self, context: &RewriteContext<'_>, shape: Shape) -> RewriteResult {
612612
match *self {
613-
ast::GenericBound::Trait(
614-
ref poly_trait_ref,
615-
ast::TraitBoundModifiers {
613+
ast::GenericBound::Trait(ref poly_trait_ref) => {
614+
let snippet = context.snippet(self.span());
615+
let has_paren = snippet.starts_with('(') && snippet.ends_with(')');
616+
let ast::TraitBoundModifiers {
616617
constness,
617618
asyncness,
618619
polarity,
619-
},
620-
) => {
621-
let snippet = context.snippet(self.span());
622-
let has_paren = snippet.starts_with('(') && snippet.ends_with(')');
620+
} = poly_trait_ref.modifiers;
623621
let mut constness = constness.as_str().to_string();
624622
if !constness.is_empty() {
625623
constness.push(' ');

0 commit comments

Comments
 (0)