diff options
| author | Takayuki Maeda <takoyaki0316@gmail.com> | 2021-09-27 00:30:39 +0900 |
|---|---|---|
| committer | Takayuki Maeda <takoyaki0316@gmail.com> | 2021-09-27 00:30:39 +0900 |
| commit | 620f480e64cb98a108d735ea4f53bb24acfc176a (patch) | |
| tree | 97509e93f5b64acd926dc365696449ca114779a5 /compiler/rustc_trait_selection/src | |
| parent | e2aad3fe60ff97fc0d0d1a68a97211918c40b100 (diff) | |
| download | rust-620f480e64cb98a108d735ea4f53bb24acfc176a.tar.gz rust-620f480e64cb98a108d735ea4f53bb24acfc176a.zip | |
better suggestions
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 01fa3a50d81..2a51e014713 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -781,19 +781,19 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { if imm_result && mut_result { err.span_suggestions( - span, + span.shrink_to_lo(), "consider borrowing here", - [format!("&{}", snippet), format!("&mut {}", snippet)].into_iter(), + ["&".to_string(), "&mut ".to_string()].into_iter(), Applicability::MaybeIncorrect, ); } else { - err.span_suggestion( - span, + err.span_suggestion_verbose( + span.shrink_to_lo(), &format!( "consider{} borrowing here", if mut_result { " mutably" } else { "" } ), - format!("&{}{}", if mut_result { "mut " } else { "" }, snippet), + format!("&{}", if mut_result { "mut " } else { "" }), Applicability::MaybeIncorrect, ); } |
