support dyn keyword(2506)
This commit is contained in:
parent
5025a53b30
commit
078fbb0819
10
src/types.rs
10
src/types.rs
@ -616,7 +616,15 @@ fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
|
||||
impl Rewrite for ast::Ty {
|
||||
fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option<String> {
|
||||
match self.node {
|
||||
ast::TyKind::TraitObject(ref bounds, ..) => bounds.rewrite(context, shape),
|
||||
ast::TyKind::TraitObject(ref bounds, tobj_syntax) => {
|
||||
let res = bounds.rewrite(context, shape)?;
|
||||
// we have to consider 'dyn' keyword is used or not!!!
|
||||
if tobj_syntax == ast::TraitObjectSyntax::Dyn {
|
||||
Some(format!("dyn {}", res))
|
||||
} else {
|
||||
Some(res)
|
||||
}
|
||||
}
|
||||
ast::TyKind::Ptr(ref mt) => {
|
||||
let prefix = match mt.mutbl {
|
||||
Mutability::Mutable => "*mut ",
|
||||
|
Loading…
Reference in New Issue
Block a user