1
Fork 0

Tweak wording

This commit is contained in:
Esteban Kuber 2022-05-03 02:07:47 +00:00
parent 57967269e9
commit 4934a9e643
10 changed files with 32 additions and 33 deletions

View file

@ -2484,15 +2484,14 @@ fn show_candidates(
("one of these", "items", String::new())
};
let tail = if path.len() > 1 { "..." } else { "" };
let instead = if let Instead::Yes = instead { " instead" } else { "" };
let mut msg = if let IsPattern::Yes = is_pattern {
format!(
"if you meant to match on {}{}{}, use the full path in the pattern{}",
kind, instead, name, tail
"if you meant to match on {}{}{}, use the full path in the pattern",
kind, instead, name
)
} else {
format!("consider importing {} {}{}{}", determiner, kind, instead, tail)
format!("consider importing {} {}{}", determiner, kind, instead)
};
for note in accessible_path_strings.iter().flat_map(|cand| cand.3.as_ref()) {
@ -2523,7 +2522,7 @@ fn show_candidates(
if let [first, .., last] = &path[..] {
err.span_suggestion_verbose(
first.ident.span.until(last.ident.span),
"...and refer to it directly",
&format!("if you import `{}`, refer to it directly", last.ident),
String::new(),
Applicability::Unspecified,
);

View file

@ -4,11 +4,11 @@ error[E0425]: cannot find function `bar` in module `a`
LL | a::bar();
| ^^^ not found in `a`
|
help: consider importing this function...
help: consider importing this function
|
LL | use b::bar;
|
help: ...and refer to it directly
help: if you import `bar`, refer to it directly
|
LL - a::bar();
LL + bar();

View file

@ -12,13 +12,13 @@ help: a tuple struct with a similar name exists
|
LL | check(m1::TS);
| ~~
help: consider importing one of these items instead...
help: consider importing one of these items instead
|
LL | use m2::S;
|
LL | use xm2::S;
|
help: ...and refer to it directly
help: if you import `S`, refer to it directly
|
LL - check(m1::S);
LL + check(S);
@ -40,13 +40,13 @@ help: a tuple struct with a similar name exists
|
LL | check(xm1::TS);
| ~~
help: consider importing one of these items instead...
help: consider importing one of these items instead
|
LL | use m2::S;
|
LL | use xm2::S;
|
help: ...and refer to it directly
help: if you import `S`, refer to it directly
|
LL - check(xm1::S);
LL + check(S);
@ -71,13 +71,13 @@ help: a tuple variant with a similar name exists
|
LL | check(m7::TV);
| ~~
help: consider importing one of these items instead...
help: consider importing one of these items instead
|
LL | use m8::V;
|
LL | use xm8::V;
|
help: ...and refer to it directly
help: if you import `V`, refer to it directly
|
LL - check(m7::V);
LL + check(V);
@ -104,13 +104,13 @@ help: a tuple variant with a similar name exists
|
LL | check(xm7::TV);
| ~~
help: consider importing one of these items instead...
help: consider importing one of these items instead
|
LL | use m8::V;
|
LL | use xm8::V;
|
help: ...and refer to it directly
help: if you import `V`, refer to it directly
|
LL - check(xm7::V);
LL + check(V);

View file

@ -10,11 +10,11 @@ error[E0425]: cannot find function `hi_str` in module `circular_modules_main`
LL | println!("{}", circular_modules_main::hi_str());
| ^^^^^^ not found in `circular_modules_main`
|
help: consider importing this function...
help: consider importing this function
|
LL | use hi_str;
|
help: ...and refer to it directly
help: if you import `hi_str`, refer to it directly
|
LL - println!("{}", circular_modules_main::hi_str());
LL + println!("{}", hi_str());

View file

@ -4,11 +4,11 @@ error[E0425]: cannot find value `A` in crate `namespaced_enums`
LL | let _ = namespaced_enums::A;
| ^ not found in `namespaced_enums`
|
help: consider importing this unit variant...
help: consider importing this unit variant
|
LL | use namespaced_enums::Foo::A;
|
help: ...and refer to it directly
help: if you import `A`, refer to it directly
|
LL - let _ = namespaced_enums::A;
LL + let _ = A;
@ -20,11 +20,11 @@ error[E0425]: cannot find function, tuple struct or tuple variant `B` in crate `
LL | let _ = namespaced_enums::B(10);
| ^ not found in `namespaced_enums`
|
help: consider importing this tuple variant...
help: consider importing this tuple variant
|
LL | use namespaced_enums::Foo::B;
|
help: ...and refer to it directly
help: if you import `B`, refer to it directly
|
LL - let _ = namespaced_enums::B(10);
LL + let _ = B(10);
@ -36,11 +36,11 @@ error[E0422]: cannot find struct, variant or union type `C` in crate `namespaced
LL | let _ = namespaced_enums::C { a: 10 };
| ^ not found in `namespaced_enums`
|
help: consider importing this variant...
help: consider importing this variant
|
LL | use namespaced_enums::Foo::C;
|
help: ...and refer to it directly
help: if you import `C`, refer to it directly
|
LL - let _ = namespaced_enums::C { a: 10 };
LL + let _ = C { a: 10 };

View file

@ -4,13 +4,13 @@ error[E0425]: cannot find value `LOG10_2` in module `std::f64`
LL | const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize;
| ^^^^^^^ not found in `std::f64`
|
help: consider importing one of these items...
help: consider importing one of these items
|
LL | use std::f32::consts::LOG10_2;
|
LL | use std::f64::consts::LOG10_2;
|
help: ...and refer to it directly
help: if you import `LOG10_2`, refer to it directly
|
LL - const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize;
LL + const M: usize = (f64::from(N) * LOG10_2) as usize;

View file

@ -4,11 +4,11 @@ error[E0433]: failed to resolve: could not find `hahmap` in `std`
LL | let _map = std::hahmap::HashMap::new();
| ^^^^^^^ not found in `std::hahmap`
|
help: consider importing this struct...
help: consider importing this struct
|
LL | use std::collections::HashMap;
|
help: ...and refer to it directly
help: if you import `HashMap`, refer to it directly
|
LL - let _map = std::hahmap::HashMap::new();
LL + let _map = HashMap::new();

View file

@ -99,13 +99,13 @@ help: a function with a similar name exists
|
LL | let _: E = m::f;
| ~
help: consider importing one of these items instead...
help: consider importing one of these items instead
|
LL | use std::f32::consts::E;
|
LL | use std::f64::consts::E;
|
help: ...and refer to it directly
help: if you import `E`, refer to it directly
|
LL - let _: E = m::E;
LL + let _: E = E;

View file

@ -10,11 +10,11 @@ error[E0412]: cannot find type `u8` in the crate root
LL | let _: ::u8;
| ^^ not found in the crate root
|
help: consider importing this builtin type...
help: consider importing this builtin type
|
LL | use std::primitive::u8;
|
help: ...and refer to it directly
help: if you import `u8`, refer to it directly
|
LL - let _: ::u8;
LL + let _: u8;

View file

@ -4,11 +4,11 @@ error[E0405]: cannot find trait `Trait` in `A`
LL | pub struct A<H: A::Trait>(pub H);
| ^^^^^ not found in `A`
|
help: consider importing this trait...
help: consider importing this trait
|
LL | use A::Trait;
|
help: ...and refer to it directly
help: if you import `Trait`, refer to it directly
|
LL - pub struct A<H: A::Trait>(pub H);
LL + pub struct A<H: Trait>(pub H);