Account for let foo = expr; to suggest const foo: Ty = expr;

This commit is contained in:
Esteban Küber 2024-07-08 19:43:20 +00:00
parent b56dc8ee90
commit cbe75486f7
13 changed files with 85 additions and 56 deletions

View file

@ -240,16 +240,18 @@ pub(crate) struct AttemptToUseNonConstantValueInConstant<'a> {
}
#[derive(Subdiagnostic)]
#[suggestion(
#[multipart_suggestion(
resolve_attempt_to_use_non_constant_value_in_constant_with_suggestion,
code = "{suggestion} ",
style = "verbose",
applicability = "maybe-incorrect"
applicability = "has-placeholders"
)]
pub(crate) struct AttemptToUseNonConstantValueInConstantWithSuggestion<'a> {
#[primary_span]
// #[primary_span]
#[suggestion_part(code = "{suggestion} ")]
pub(crate) span: Span,
pub(crate) suggestion: &'a str,
#[suggestion_part(code = ": /* Type */")]
pub(crate) type_span: Option<Span>,
pub(crate) current: &'a str,
}