Skip to content

Commit af74fbb

Browse files
committed
Changes per comments and moved test cases files
1 parent f91353a commit af74fbb

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

src/formatting/items.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -1204,13 +1204,9 @@ pub(crate) fn format_trait(
12041204
}
12051205
result.push_str(&where_clause_str);
12061206
}
1207-
let pre_block_span = if !generics.where_clause.predicates.is_empty() {
1208-
mk_sp(generics.where_clause.span.hi(), item.span.hi())
1209-
} else if !generic_bounds.is_empty() {
1210-
mk_sp(generic_bounds.last().unwrap().span().hi(), item.span.hi())
1211-
} else {
1212-
item.span
1213-
};
1207+
1208+
/* Note: `where_clause` always exists; Span is empty when no where clause in the code */
1209+
let pre_block_span = mk_sp(generics.where_clause.span.hi(), item.span.hi());
12141210
let pre_block_snippet = context.snippet(pre_block_span);
12151211
if let Some(lo) = pre_block_snippet.find('/') {
12161212
// 1 = `{`

0 commit comments

Comments
 (0)