Skip to content

Commit 6ddbef1

Browse files
Simplify suggestion
1 parent a9199de commit 6ddbef1

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

src/librustc_typeck/check/callee.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,11 @@ pub fn check_legal_trait_for_method_call(
3838
let suggestion =
3939
if snippet.is_empty() { "drop".to_string() } else { format!("drop({})", snippet) };
4040

41-
let suggestion_span =
42-
receiver.and_then(|s| tcx.sess.source_map().merge_spans(s, span)).unwrap_or(span);
43-
4441
err.span_suggestion(
45-
suggestion_span,
46-
"consider using `drop` function",
47-
suggestion,
48-
Applicability::MaybeIncorrect,
42+
span,
43+
&format!("consider using `drop` function: `{}`", suggestion),
44+
String::new(),
45+
Applicability::Unspecified,
4946
);
5047

5148
err.emit();

src/test/ui/error-codes/E0040.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ error[E0040]: explicit use of destructor method
22
--> $DIR/E0040.rs:13:7
33
|
44
LL | x.drop();
5-
| --^^^^
6-
| | |
7-
| | explicit destructor calls not allowed
8-
| help: consider using `drop` function: `drop(x)`
5+
| ^^^^
6+
| |
7+
| explicit destructor calls not allowed
8+
| help: consider using `drop` function: `drop(x)`
99

1010
error: aborting due to previous error
1111

src/test/ui/explicit/explicit-call-to-dtor.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ error[E0040]: explicit use of destructor method
22
--> $DIR/explicit-call-to-dtor.rs:13:7
33
|
44
LL | x.drop();
5-
| --^^^^
6-
| | |
7-
| | explicit destructor calls not allowed
8-
| help: consider using `drop` function: `drop(x)`
5+
| ^^^^
6+
| |
7+
| explicit destructor calls not allowed
8+
| help: consider using `drop` function: `drop(x)`
99

1010
error: aborting due to previous error
1111

src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ error[E0040]: explicit use of destructor method
22
--> $DIR/explicit-call-to-supertrait-dtor.rs:17:14
33
|
44
LL | self.drop();
5-
| -----^^^^
6-
| | |
7-
| | explicit destructor calls not allowed
8-
| help: consider using `drop` function: `drop(self)`
5+
| ^^^^
6+
| |
7+
| explicit destructor calls not allowed
8+
| help: consider using `drop` function: `drop(self)`
99

1010
error: aborting due to previous error
1111

0 commit comments

Comments
 (0)