about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-05 08:12:55 +0000
committerbors <bors@rust-lang.org>2023-10-05 08:12:55 +0000
commite2939270168f2a23ef2ec0b2a193dbb63f92ae07 (patch)
tree52ada6f95f403dd029121de9dc60fde48adbc52d /src
parent5236c8e1fa25c45f11f02ae72fc27f64d86ba606 (diff)
parent4a14a80605dd187e46badc24c6fda4120d915b0c (diff)
downloadrust-e2939270168f2a23ef2ec0b2a193dbb63f92ae07.tar.gz
rust-e2939270168f2a23ef2ec0b2a193dbb63f92ae07.zip
Auto merge of #116443 - workingjubilee:rollup-r9mh13f, r=workingjubilee
Rollup of 5 pull requests

Successful merges:

 - #116223 (Fix misuses of a vs an)
 - #116296 (More accurately point to where default return type should go)
 - #116429 (Diagnostics: Be more careful when suggesting struct fields)
 - #116431 (Tweak wording of E0562)
 - #116432 (rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 2))

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/doc/rustc/src/platform-support/mips-release-6.md2
-rw-r--r--src/tools/clippy/clippy_lints/src/methods/unnecessary_literal_unwrap.rs8
-rw-r--r--src/tools/clippy/tests/ui-toml/too_many_arguments/too_many_arguments.stderr2
-rw-r--r--src/tools/clippy/tests/ui/functions.stderr6
-rw-r--r--src/tools/clippy/tests/ui/must_use_unit.stderr4
-rw-r--r--src/tools/clippy/tests/ui/unnecessary_literal_unwrap.fixed4
-rw-r--r--src/tools/clippy/tests/ui/unnecessary_literal_unwrap.stderr4
-rw-r--r--src/tools/rustfmt/src/items.rs3
8 files changed, 15 insertions, 18 deletions
diff --git a/src/doc/rustc/src/platform-support/mips-release-6.md b/src/doc/rustc/src/platform-support/mips-release-6.md
index 3f1912fc6f9..9203a31e9f4 100644
--- a/src/doc/rustc/src/platform-support/mips-release-6.md
+++ b/src/doc/rustc/src/platform-support/mips-release-6.md
@@ -67,7 +67,7 @@ The following procedure outlines the build process for the MIPS64 R6 target with
 
 ### Prerequisite: Disable debuginfo
 
-A LLVM bug makes rustc crash if debug or debug info generation is enabled. You need to edit `config.toml` to disable this:
+An LLVM bug makes rustc crash if debug or debug info generation is enabled. You need to edit `config.toml` to disable this:
 
 ```toml
 [rust]
diff --git a/src/tools/clippy/clippy_lints/src/methods/unnecessary_literal_unwrap.rs b/src/tools/clippy/clippy_lints/src/methods/unnecessary_literal_unwrap.rs
index 937aac8d25e..24c0ea3f60a 100644
--- a/src/tools/clippy/clippy_lints/src/methods/unnecessary_literal_unwrap.rs
+++ b/src/tools/clippy/clippy_lints/src/methods/unnecessary_literal_unwrap.rs
@@ -102,14 +102,10 @@ pub(super) fn check(
             ]),
             ("None", "unwrap_or_else", _) => match args[0].kind {
                 hir::ExprKind::Closure(hir::Closure {
-                    fn_decl:
-                        hir::FnDecl {
-                            output: hir::FnRetTy::DefaultReturn(span) | hir::FnRetTy::Return(hir::Ty { span, .. }),
-                            ..
-                        },
+                    body,
                     ..
                 }) => Some(vec![
-                    (expr.span.with_hi(span.hi()), String::new()),
+                    (expr.span.with_hi(cx.tcx.hir().body(*body).value.span.lo()), String::new()),
                     (expr.span.with_lo(args[0].span.hi()), String::new()),
                 ]),
                 _ => None,
diff --git a/src/tools/clippy/tests/ui-toml/too_many_arguments/too_many_arguments.stderr b/src/tools/clippy/tests/ui-toml/too_many_arguments/too_many_arguments.stderr
index a52e1fcb9e3..8b9d159b59c 100644
--- a/src/tools/clippy/tests/ui-toml/too_many_arguments/too_many_arguments.stderr
+++ b/src/tools/clippy/tests/ui-toml/too_many_arguments/too_many_arguments.stderr
@@ -2,7 +2,7 @@ error: this function has too many arguments (11/10)
   --> $DIR/too_many_arguments.rs:4:1
    |
 LL | fn too_many(p1: u8, p2: u8, p3: u8, p4: u8, p5: u8, p6: u8, p7: u8, p8: u8, p9: u8, p10: u8, p11: u8) {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::too-many-arguments` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::too_many_arguments)]`
diff --git a/src/tools/clippy/tests/ui/functions.stderr b/src/tools/clippy/tests/ui/functions.stderr
index 371ea161260..4b06cd03889 100644
--- a/src/tools/clippy/tests/ui/functions.stderr
+++ b/src/tools/clippy/tests/ui/functions.stderr
@@ -2,7 +2,7 @@ error: this function has too many arguments (8/7)
   --> $DIR/functions.rs:8:1
    |
 LL | fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::too-many-arguments` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::too_many_arguments)]`
@@ -17,7 +17,7 @@ LL | |     two: u32,
 ...  |
 LL | |     eight: ()
 LL | | ) {
-   | |__^
+   | |_^
 
 error: this function has too many arguments (8/7)
   --> $DIR/functions.rs:48:5
@@ -29,7 +29,7 @@ error: this function has too many arguments (8/7)
   --> $DIR/functions.rs:58:5
    |
 LL |     fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: this public function might dereference a raw pointer but is not marked `unsafe`
   --> $DIR/functions.rs:68:34
diff --git a/src/tools/clippy/tests/ui/must_use_unit.stderr b/src/tools/clippy/tests/ui/must_use_unit.stderr
index e67d9b5b9d8..f2ee185857d 100644
--- a/src/tools/clippy/tests/ui/must_use_unit.stderr
+++ b/src/tools/clippy/tests/ui/must_use_unit.stderr
@@ -4,7 +4,7 @@ error: this unit-returning function has a `#[must_use]` attribute
 LL | #[must_use]
    | ----------- help: remove the attribute
 LL | pub fn must_use_default() {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::must-use-unit` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::must_use_unit)]`
@@ -23,7 +23,7 @@ error: this unit-returning function has a `#[must_use]` attribute
 LL | #[must_use = "With note"]
    | ------------------------- help: remove the attribute
 LL | pub fn must_use_with_note() {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 3 previous errors
 
diff --git a/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.fixed b/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.fixed
index 87df1f8cb08..b17343aa9ba 100644
--- a/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.fixed
+++ b/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.fixed
@@ -23,7 +23,7 @@ fn unwrap_option_none() {
     let _val: u16 = 234;
     let _val: u16 = 234;
     let _val: u16 = { 234 };
-    let _val: u16 =  { 234 };
+    let _val: u16 = { 234 };
 
     panic!();
     panic!("this always happens");
@@ -31,7 +31,7 @@ fn unwrap_option_none() {
     234;
     234;
     { 234 };
-     { 234 };
+    { 234 };
 }
 
 fn unwrap_result_ok() {
diff --git a/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.stderr b/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.stderr
index 013907f59c4..4940091be60 100644
--- a/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.stderr
+++ b/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.stderr
@@ -116,7 +116,7 @@ LL |     let _val: u16 = None.unwrap_or_else(|| -> u16 { 234 });
 help: remove the `None` and `unwrap_or_else()`
    |
 LL -     let _val: u16 = None.unwrap_or_else(|| -> u16 { 234 });
-LL +     let _val: u16 =  { 234 };
+LL +     let _val: u16 = { 234 };
    |
 
 error: used `unwrap()` on `None` value
@@ -187,7 +187,7 @@ LL |     None::<u16>.unwrap_or_else(|| -> u16 { 234 });
 help: remove the `None` and `unwrap_or_else()`
    |
 LL -     None::<u16>.unwrap_or_else(|| -> u16 { 234 });
-LL +      { 234 };
+LL +     { 234 };
    |
 
 error: used `unwrap()` on `Ok` value
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),