Skip to content

Commit

Permalink
make suggestion text more legible
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-Flash committed Nov 16, 2023
1 parent 10f1431 commit 0aacf24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1970,7 +1970,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
{
if !ident_span.from_expansion() {
let (span, text) = match self.r.tcx.sess.source_map().span_to_snippet(ident_span) {
Ok(var_name) => {
Ok(var_name) if var_name.starts_with("let") => {
// a special case for #117894
let text = var_name.strip_prefix("let").and_then(|rest| {
match rest.starts_with("_") {
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/suggestions/suggest-let-for-assignment.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LL | demo = 1;
help: you might have meant to introduce a new binding
|
LL | let demo = 1;
| ~~~~~~~~
| +++

error[E0425]: cannot find value `demo` in this scope
--> $DIR/suggest-let-for-assignment.rs:5:10
Expand All @@ -24,7 +24,7 @@ LL | x = "x";
help: you might have meant to introduce a new binding
|
LL | let x = "x";
| ~~~~~
| +++

error[E0425]: cannot find value `x` in this scope
--> $DIR/suggest-let-for-assignment.rs:8:23
Expand Down Expand Up @@ -81,7 +81,7 @@ LL | y = 1 + 2;
help: you might have meant to introduce a new binding
|
LL | let y = 1 + 2;
| ~~~~~
| +++

error[E0425]: cannot find value `y` in this scope
--> $DIR/suggest-let-for-assignment.rs:22:23
Expand Down

0 comments on commit 0aacf24

Please sign in to comment.