Skip to content

Commit

Permalink
fix wildcard type annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
pratapsingh1729 committed Nov 10, 2023
1 parent 73910ea commit ad3654f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ fn to_doc<'a>(
.brackets()
}
Rule::slice_type => map_to_doc(ctx, arena, pair).brackets(),
Rule::infer_type => map_to_doc(ctx, arena, pair),
Rule::infer_type => arena.text("_").append(map_to_doc(ctx, arena, pair)),
Rule::fn_ptr_type => map_to_doc(ctx, arena, pair),
Rule::fn_trait_type => map_to_doc(ctx, arena, pair),
Rule::for_type => map_to_doc(ctx, arena, pair),
Expand Down
17 changes: 17 additions & 0 deletions tests/rustfmt-tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,20 @@ use LongLongLongLongLongLongLongLongLongLongType as LongerLongLongLongLongLongLo
"#;
compare(file);
}

#[test]
fn rust_wildcard_type_annotation() {
let file = r#"
fn foo() {
let x: _ = bar();
}
fn blah() {
let (temp_owl__x607, Tracked(itree)): ( _
, Tracked<ITreeToken<(Seq<u8>, state_Initiator), Endpoint>> ) = { baz(); };
}
"#;
compare(file);

}

0 comments on commit ad3654f

Please sign in to comment.