Skip to content

Prevent rustfmt from adding impl Trait definitions to types #5092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1521,10 +1521,7 @@ pub(crate) fn rewrite_type_alias<'a, 'b>(
// https://rustc-dev-guide.rust-lang.org/opaque-types-type-alias-impl-trait.html
// https://github.com/rust-dev-tools/fmt-rfcs/blob/master/guide/items.md#type-aliases
match (visitor_kind, ty_opt) {
(Item(_), None) => {
let op_ty = OpaqueType { bounds };
rewrite_ty(rw_info, Some(bounds), Some(&op_ty), vis)
}
(Item(_), None) => rewrite_ty::<OpaqueType<'_>>(rw_info, Some(bounds), None, vis),
(Item(_), Some(ty)) => rewrite_ty(rw_info, Some(bounds), Some(&*ty), vis),
(AssocImplItem(_), _) => {
let result = if let Some(ast::Ty {
Expand Down
1 change: 1 addition & 0 deletions tests/target/issue-5086/minimum_example.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Type: Bound;