More robust as_ref/as_deref suggestions

This commit is contained in:
Michael Goulet 2023-05-30 18:47:50 +00:00
parent 522ae84e03
commit af54d584b2
12 changed files with 208 additions and 153 deletions

View file

@ -1246,30 +1246,6 @@ pub struct FnConsiderCasting {
pub casting: String,
}
#[derive(Subdiagnostic)]
pub enum SuggestAsRefWhereAppropriate<'a> {
#[suggestion(
infer_sarwa_option,
code = "{snippet}.as_ref()",
applicability = "machine-applicable"
)]
Option {
#[primary_span]
span: Span,
snippet: &'a str,
},
#[suggestion(
infer_sarwa_result,
code = "{snippet}.as_ref()",
applicability = "machine-applicable"
)]
Result {
#[primary_span]
span: Span,
snippet: &'a str,
},
}
#[derive(Subdiagnostic)]
pub enum SuggestAccessingField<'a> {
#[suggestion(