Skip to content

Commit

Permalink
Changes per comments and moved test cases files(1)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidBar-On committed Mar 19, 2021
1 parent b63aeea commit bceaf18
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/formatting/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1204,13 +1204,9 @@ pub(crate) fn format_trait(
}
result.push_str(&where_clause_str);
}
let pre_block_span = if !generics.where_clause.predicates.is_empty() {
mk_sp(generics.where_clause.span.hi(), item.span.hi())
} else if !generic_bounds.is_empty() {
mk_sp(generic_bounds.last().unwrap().span().hi(), item.span.hi())
} else {
item.span
};

/* Note: `where_clause` always exists; Span is empty when no where clause in the code */
let pre_block_span = mk_sp(generics.where_clause.span.hi(), item.span.hi());
let pre_block_snippet = context.snippet(pre_block_span);
if let Some(lo) = pre_block_snippet.find('/') {
// 1 = `{`
Expand Down

0 comments on commit bceaf18

Please sign in to comment.