This commit is contained in:
Ivan Tham 2019-11-25 08:14:10 +08:00 committed by Who? Me?!
parent 4b391fa7fd
commit 885882db21
1 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,7 @@ let mut err = sess.struct_span_err(sp, "oh no! this is an error!");
if let Ok(snippet) = sess.source_map().span_to_snippet(sp) { if let Ok(snippet) = sess.source_map().span_to_snippet(sp) {
// Use the snippet to generate a suggested fix // Use the snippet to generate a suggested fix
err.span_suggestion(suggestion_sp, "try using a qux here", format!("qux {}", snip)); err.span_suggestion(suggestion_sp, "try using a qux here", format!("qux {}", snippet));
} else { } else {
// If we weren't able to generate a snippet, then emit a "help" message // If we weren't able to generate a snippet, then emit a "help" message
// instead of a concrete "suggestion". In practice this is unlikely to be // instead of a concrete "suggestion". In practice this is unlikely to be
@ -100,7 +100,7 @@ if let Ok(snippet) = sess.source_map().span_to_snippet(sp) {
err.span_suggestion( err.span_suggestion(
suggestion_sp, suggestion_sp,
"try using a qux here", "try using a qux here",
format!("qux {}", snip), format!("qux {}", snippet),
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
} else { } else {