Rustfmt support for negative bounds, test
This commit is contained in:
parent
8e330f9d5b
commit
8ed5d5de3d
@ -552,8 +552,12 @@ fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option<String>
|
|||||||
ast::TraitBoundModifier::MaybeConstMaybe => poly_trait_ref
|
ast::TraitBoundModifier::MaybeConstMaybe => poly_trait_ref
|
||||||
.rewrite(context, shape.offset_left(8)?)
|
.rewrite(context, shape.offset_left(8)?)
|
||||||
.map(|s| format!("~const ?{}", s)),
|
.map(|s| format!("~const ?{}", s)),
|
||||||
rustc_ast::TraitBoundModifier::Negative
|
ast::TraitBoundModifier::Negative => poly_trait_ref
|
||||||
| rustc_ast::TraitBoundModifier::MaybeConstNegative => None,
|
.rewrite(context, shape.offset_left(1)?)
|
||||||
|
.map(|s| format!("!{}", s)),
|
||||||
|
ast::TraitBoundModifier::MaybeConstNegative => poly_trait_ref
|
||||||
|
.rewrite(context, shape.offset_left(8)?)
|
||||||
|
.map(|s| format!("~const !{}", s)),
|
||||||
};
|
};
|
||||||
rewrite.map(|s| if has_paren { format!("({})", s) } else { s })
|
rewrite.map(|s| if has_paren { format!("({})", s) } else { s })
|
||||||
}
|
}
|
||||||
|
11
tests/target/negative-bounds.rs
Normal file
11
tests/target/negative-bounds.rs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fn negative()
|
||||||
|
where
|
||||||
|
i32: !Copy,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
fn maybe_const_negative()
|
||||||
|
where
|
||||||
|
i32: ~const !Copy,
|
||||||
|
{
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user