mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 09:23:05 +00:00
Simplify suggestion
This commit is contained in:
parent
a9199de34d
commit
6ddbef170b
@ -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();
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user