]> git.lizzy.rs Git - rust.git/commitdiff
Simplify suggestion
authorStanislav Tkach <stanislav.tkach@gmail.com>
Tue, 26 May 2020 20:06:46 +0000 (23:06 +0300)
committerStanislav Tkach <stanislav.tkach@gmail.com>
Tue, 26 May 2020 20:06:46 +0000 (23:06 +0300)
src/librustc_typeck/check/callee.rs
src/test/ui/error-codes/E0040.stderr
src/test/ui/explicit/explicit-call-to-dtor.stderr
src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr

index a32174a83337df933c44ece6883b87c9b4eb033b..f4e46a04931519b95e5386734bcafa02e87614c1 100644 (file)
@@ -38,14 +38,11 @@ pub fn check_legal_trait_for_method_call(
         let suggestion =
             if snippet.is_empty() { "drop".to_string() } else { format!("drop({})", snippet) };
 
-        let suggestion_span =
-            receiver.and_then(|s| tcx.sess.source_map().merge_spans(s, span)).unwrap_or(span);
-
         err.span_suggestion(
-            suggestion_span,
-            "consider using `drop` function",
-            suggestion,
-            Applicability::MaybeIncorrect,
+            span,
+            &format!("consider using `drop` function: `{}`", suggestion),
+            String::new(),
+            Applicability::Unspecified,
         );
 
         err.emit();
index 3b864d4ea4b2c4574f956939c1857e152eb33806..69cf28b29704fafa1452cc6ded0ea23aa75bf480 100644 (file)
@@ -2,10 +2,10 @@ error[E0040]: explicit use of destructor method
   --> $DIR/E0040.rs:13:7
    |
 LL |     x.drop();
-   |     --^^^^
-   |     | |
-   |     | explicit destructor calls not allowed
-   |     help: consider using `drop` function: `drop(x)`
+   |       ^^^^
+   |       |
+   |       explicit destructor calls not allowed
+   |       help: consider using `drop` function: `drop(x)`
 
 error: aborting due to previous error
 
index 33ce235b30fdae3ea9c90d65675046dfb8f45350..5ebe4ee4b90f89a146dc7dda6cdc5f914fae7ef6 100644 (file)
@@ -2,10 +2,10 @@ error[E0040]: explicit use of destructor method
   --> $DIR/explicit-call-to-dtor.rs:13:7
    |
 LL |     x.drop();
-   |     --^^^^
-   |     | |
-   |     | explicit destructor calls not allowed
-   |     help: consider using `drop` function: `drop(x)`
+   |       ^^^^
+   |       |
+   |       explicit destructor calls not allowed
+   |       help: consider using `drop` function: `drop(x)`
 
 error: aborting due to previous error
 
index 2e7bfac71cd3274b5347affd598504ab70954526..cd3fb3119a5cfae286bbf7b0ad624f18da19374c 100644 (file)
@@ -2,10 +2,10 @@ error[E0040]: explicit use of destructor method
   --> $DIR/explicit-call-to-supertrait-dtor.rs:17:14
    |
 LL |         self.drop();
-   |         -----^^^^
-   |         |    |
-   |         |    explicit destructor calls not allowed
-   |         help: consider using `drop` function: `drop(self)`
+   |              ^^^^
+   |              |
+   |              explicit destructor calls not allowed
+   |              help: consider using `drop` function: `drop(self)`
 
 error: aborting due to previous error