Skip to content

Commit 1da9006

Browse files
committed
Per review comment - add test cases from rust-lang#4649
1 parent 7000d6c commit 1da9006

File tree

5 files changed

+65
-1
lines changed

5 files changed

+65
-1
lines changed

src/items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2418,7 +2418,7 @@ fn rewrite_fn_base(
24182418
result.push_str(&ret_str);
24192419
}
24202420

2421-
// Clusure to handle a comment in a snippet
2421+
// Closure to handle a comment in a snippet
24222422
let mut snippet_comment_handling = |span_lo, span_hi, consider_force_new_line_for_brace| {
24232423
let snippet = context.snippet(mk_sp(span_lo, span_hi));
24242424
// Try to preserve the layout of the original snippet.

tests/source/issue-5407/one.rs

+17
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ String::new()
1515
}
1616
}
1717

18+
// Original from #4649
19+
trait Foo {
20+
fn bar(&self)
21+
where
22+
// Self: Bar
23+
// Some comment
24+
;
25+
}
26+
27+
fn foo<T>()
28+
where
29+
// T: Bar,
30+
// Some comment
31+
{
32+
println!("foo");
33+
}
34+
1835
// Return-type with no "where" - one comment
1936
fn main () {
2037
fn foo1() -> String /* same-line with ret-type and brace comment */ {

tests/source/issue-5407/two.rs

+17
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ String::new()
1515
}
1616
}
1717

18+
// Original from #4649
19+
trait Foo {
20+
fn bar(&self)
21+
where
22+
// Self: Bar
23+
// Some comment
24+
;
25+
}
26+
27+
fn foo<T>()
28+
where
29+
// T: Bar,
30+
// Some comment
31+
{
32+
println!("foo");
33+
}
34+
1835
// Return-type with no "where" - one comment
1936
fn main () {
2037
fn foo1() -> String /* same-line with ret-type and brace comment */ {

tests/target/issue-5407/one.rs

+15
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ mod inner {
1313
}
1414
}
1515

16+
// Original from #4649
17+
trait Foo {
18+
fn bar(&self)
19+
// Self: Bar
20+
// Some comment
21+
;
22+
}
23+
24+
fn foo<T>()
25+
// T: Bar,
26+
// Some comment
27+
{
28+
println!("foo");
29+
}
30+
1631
// Return-type with no "where" - one comment
1732
fn main() {
1833
fn foo1() -> String /* same-line with ret-type and brace comment */ {}

tests/target/issue-5407/two.rs

+15
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ mod inner {
1313
}
1414
}
1515

16+
// Original from #4649
17+
trait Foo {
18+
fn bar(&self)
19+
// Self: Bar
20+
// Some comment
21+
;
22+
}
23+
24+
fn foo<T>()
25+
// T: Bar,
26+
// Some comment
27+
{
28+
println!("foo");
29+
}
30+
1631
// Return-type with no "where" - one comment
1732
fn main() {
1833
fn foo1() -> String /* same-line with ret-type and brace comment */ {}

0 commit comments

Comments
 (0)