Some would argue that this 40-character method name is ludicrously
unwieldy (even ironic), but it's the unique continuation of the
precedent set by the other suggestion methods. (And there is some hope
that someday we'll just fold `Applicability` into the signature of the
"basic" method `span_suggestion`.)
This is in support of #50723.
self
}
+ pub fn span_suggestion_short_with_applicability(
+ &mut self, sp: Span, msg: &str, suggestion: String, applicability: Applicability
+ ) -> &mut Self {
+ self.suggestions.push(CodeSuggestion {
+ substitutions: vec![Substitution {
+ parts: vec![SubstitutionPart {
+ snippet: suggestion,
+ span: sp,
+ }],
+ }],
+ msg: msg.to_owned(),
+ show_code_when_inline: false,
+ applicability: applicability,
+ });
+ self
+ }
+
pub fn set_span<S: Into<MultiSpan>>(&mut self, sp: S) -> &mut Self {
self.span = sp.into();
self
suggestions: Vec<String>,
applicability: Applicability)
-> &mut Self);
+ forward!(pub fn span_suggestion_short_with_applicability(&mut self,
+ sp: Span,
+ msg: &str,
+ suggestion: String,
+ applicability: Applicability)
+ -> &mut Self);
forward!(pub fn set_span<S: Into<MultiSpan>>(&mut self, sp: S) -> &mut Self);
forward!(pub fn code(&mut self, s: DiagnosticId) -> &mut Self);