about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-10-04 21:09:50 +0000
committerMichael Goulet <michael@errs.io>2023-10-04 21:09:54 +0000
commitdd5f26c42dbe24491cc2aae12bca747d1701936c (patch)
treef64fc7069903739a91fb644e971fc07419fbd8cf
parent1f079cfb440c05578fce656999d363d916500850 (diff)
downloadrust-dd5f26c42dbe24491cc2aae12bca747d1701936c.tar.gz
rust-dd5f26c42dbe24491cc2aae12bca747d1701936c.zip
Fix spans for comments in rustfmt
-rw-r--r--src/tools/rustfmt/src/items.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tools/rustfmt/src/items.rs b/src/tools/rustfmt/src/items.rs
index d5bc38303e0..002cffa9b0c 100644
--- a/src/tools/rustfmt/src/items.rs
+++ b/src/tools/rustfmt/src/items.rs
@@ -2599,7 +2599,8 @@ fn rewrite_fn_base(
     if where_clause_str.is_empty() {
         if let ast::FnRetTy::Default(ret_span) = fd.output {
             match recover_missing_comment_in_span(
-                mk_sp(params_span.hi(), ret_span.hi()),
+                // from after the closing paren to right before block or semicolon
+                mk_sp(ret_span.lo(), span.hi()),
                 shape,
                 context,
                 last_line_width(&result),