]> git.lizzy.rs Git - rust.git/commitdiff
remove `_with_applicability` from suggestion fns
authorAndy Russell <arussell123@gmail.com>
Fri, 25 Jan 2019 21:03:27 +0000 (16:03 -0500)
committerAndy Russell <arussell123@gmail.com>
Sun, 27 Jan 2019 04:07:55 +0000 (23:07 -0500)
53 files changed:
src/librustc/hir/lowering.rs
src/librustc/infer/error_reporting/mod.rs
src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs
src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs
src/librustc/lint/builtin.rs
src/librustc/lint/levels.rs
src/librustc/middle/liveness.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/session/mod.rs
src/librustc/traits/error_reporting.rs
src/librustc/ty/error.rs
src/librustc_borrowck/borrowck/gather_loans/move_error.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_borrowck/borrowck/unused.rs
src/librustc_errors/diagnostic.rs
src/librustc_errors/diagnostic_builder.rs
src/librustc_lint/builtin.rs
src/librustc_lint/nonstandard_style.rs
src/librustc_lint/types.rs
src/librustc_lint/unused.rs
src/librustc_mir/borrow_check/error_reporting.rs
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/borrow_check/move_errors.rs
src/librustc_mir/borrow_check/mutability_errors.rs
src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs
src/librustc_mir/hair/pattern/check_match.rs
src/librustc_passes/ast_validation.rs
src/librustc_passes/loops.rs
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/lib.rs
src/librustc_resolve/macros.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/_match.rs
src/librustc_typeck/check/callee.rs
src/librustc_typeck/check/cast.rs
src/librustc_typeck/check/compare_method.rs
src/librustc_typeck/check/demand.rs
src/librustc_typeck/check/method/mod.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/method/suggest.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/op.rs
src/librustc_typeck/check_unused.rs
src/librustc_typeck/structured_errors.rs
src/librustdoc/passes/check_code_block_syntax.rs
src/libsyntax/attr/builtin.rs
src/libsyntax/config.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/lexer/unicode_chars.rs
src/libsyntax/parse/parser.rs
src/libsyntax_ext/format.rs

index 905a3ceed81c9d04bd957241a773c7de0102ca70..51dbad92225e1bc906f07632ed77adbdead749f5 100644 (file)
@@ -1829,7 +1829,7 @@ fn lower_path_segment(
                         if let Ok(snippet) = self.sess.source_map().span_to_snippet(data.span) {
                             // Do not suggest going from `Trait()` to `Trait<>`
                             if data.inputs.len() > 0 {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     data.span,
                                     "use angle brackets instead",
                                     format!("<{}>", &snippet[1..snippet.len() - 1]),
index 35f6e6aa610ad8d052f4f35ca78fc96596fd2579..66e4cd49c807f6d4d1fcc35d12dcc945ca39ea90 100644 (file)
@@ -499,7 +499,7 @@ fn note_error_origin(
                 if let Some(ty::error::ExpectedFound { found, .. }) = exp_found {
                     if ty.is_box() && ty.boxed_ty() == found {
                         if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 span,
                                 "consider dereferencing the boxed value",
                                 format!("*{}", snippet),
@@ -532,7 +532,7 @@ fn note_error_origin(
                 err.span_label(then, "expected because of this");
                 outer.map(|sp| err.span_label(sp, "if and else have incompatible types"));
                 if let Some(sp) = semicolon {
-                    err.span_suggestion_short_with_applicability(
+                    err.span_suggestion_short(
                         sp,
                         "consider removing this semicolon",
                         String::new(),
@@ -1084,7 +1084,7 @@ fn suggest_as_ref_where_appropriate(
                                 self.tcx.sess.source_map().span_to_snippet(span),
                                 show_suggestion,
                             ) {
-                                diag.span_suggestion_with_applicability(
+                                diag.span_suggestion(
                                     span,
                                     msg,
                                     format!("{}.as_ref()", snippet),
@@ -1273,7 +1273,7 @@ fn binding_suggestion<'tcx, S: fmt::Display>(
                     let tail = if has_lifetimes { " + " } else { "" };
                     format!("{}: {}{}", bound_kind, sub, tail)
                 };
-                err.span_suggestion_short_with_applicability(
+                err.span_suggestion_short(
                     sp,
                     &consider,
                     suggestion,
index daab0a8e96263d434a5efa51adc968539332b68f..918a46aacd04113f0012152a20929b584e9ffa8f 100644 (file)
@@ -102,7 +102,7 @@ pub(super) fn try_report_named_anon_conflict(&self) -> Option<ErrorReported> {
             E0621,
             "explicit lifetime required in {}",
             error_var
-        ).span_suggestion_with_applicability(
+        ).span_suggestion(
             new_ty_span,
             &format!("add explicit lifetime `{}` to {}", named, span_label_var),
             new_ty.to_string(),
index 9fc3bb05cdab1f9e495cd9e706454728b2083ee9..7501e2f2108880a8b6912996d5e7fbd7f7c3c74e 100644 (file)
@@ -53,7 +53,7 @@ pub(super) fn try_report_static_impl_trait(&self) -> Option<ErrorReported> {
                         _ => "'_".to_owned(),
                     };
                     if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(return_sp) {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             return_sp,
                             &format!(
                                 "you can add a constraint to the return type to make it last \
index 2b5fcafc90505963c84179dd8359fa9a15de26b5..35a038235957208f2d672be7536205495791e998 100644 (file)
@@ -473,7 +473,7 @@ pub fn run(self, sess: &Session, db: &mut DiagnosticBuilder<'_>) {
                     Ok(s) => (format!("dyn {}", s), Applicability::MachineApplicable),
                     Err(_) => ("dyn <type>".to_string(), Applicability::HasPlaceholders)
                 };
-                db.span_suggestion_with_applicability(span, "use `dyn`", sugg, app);
+                db.span_suggestion(span, "use `dyn`", sugg, app);
             }
             BuiltinLintDiagnostics::AbsPathWithModule(span) => {
                 let (sugg, app) = match sess.source_map().span_to_snippet(span) {
@@ -490,7 +490,7 @@ pub fn run(self, sess: &Session, db: &mut DiagnosticBuilder<'_>) {
                     }
                     Err(_) => ("crate::<path>".to_string(), Applicability::HasPlaceholders)
                 };
-                db.span_suggestion_with_applicability(span, "use `crate`", sugg, app);
+                db.span_suggestion(span, "use `crate`", sugg, app);
             }
             BuiltinLintDiagnostics::DuplicatedMacroExports(ident, earlier_span, later_span) => {
                 db.span_label(later_span, format!("`{}` already exported", ident));
@@ -531,7 +531,7 @@ pub fn run(self, sess: &Session, db: &mut DiagnosticBuilder<'_>) {
                         (insertion_span, anon_lts)
                     }
                 };
-                db.span_suggestion_with_applicability(
+                db.span_suggestion(
                     replace_span,
                     &format!("indicate the anonymous lifetime{}", if n >= 2 { "s" } else { "" }),
                     suggestion,
@@ -539,12 +539,7 @@ pub fn run(self, sess: &Session, db: &mut DiagnosticBuilder<'_>) {
                 );
             }
             BuiltinLintDiagnostics::UnknownCrateTypes(span, note, sugg) => {
-                db.span_suggestion_with_applicability(
-                    span,
-                    &note,
-                    sugg,
-                    Applicability::MaybeIncorrect
-                );
+                db.span_suggestion(span, &note, sugg, Applicability::MaybeIncorrect);
             }
         }
     }
index 8b45a5a1504b5b5236bc299782bf4b382b0c8c38..616915769435d37abddead5eeec9ba19a9d49c9b 100644 (file)
@@ -324,7 +324,7 @@ pub fn push(&mut self, attrs: &[ast::Attribute]) -> BuilderPush {
                                     Some(li.span.into()),
                                     &msg,
                                 );
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     li.span,
                                     "change it to",
                                     new_lint_name.to_string(),
@@ -362,7 +362,7 @@ pub fn push(&mut self, attrs: &[ast::Attribute]) -> BuilderPush {
                                                               Some(li.span.into()),
                                                               &msg);
                         if let Some(new_name) = renamed {
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 li.span,
                                 "use the new name",
                                 new_name,
@@ -386,7 +386,7 @@ pub fn push(&mut self, attrs: &[ast::Attribute]) -> BuilderPush {
                                                 &msg);
 
                         if let Some(suggestion) = suggestion {
-                            db.span_suggestion_with_applicability(
+                            db.span_suggestion(
                                 li.span,
                                 "did you mean",
                                 suggestion.to_string(),
index 220bec735a47360b828ed4482c24f8d183181717..cc0dd71738fcecc6a93ede8032fa679a810fcccb 100644 (file)
@@ -1600,12 +1600,16 @@ fn warn_about_unused(&self,
                     let mut err = self.ir.tcx
                         .struct_span_lint_hir(lint::builtin::UNUSED_VARIABLES, hir_id, sp, &msg);
                     if self.ir.variable_is_shorthand(var) {
-                        err.span_suggestion_with_applicability(sp, "try ignoring the field",
-                                                               format!("{}: _", name),
-                                                               Applicability::MachineApplicable);
+                        err.span_suggestion(
+                            sp,
+                            "try ignoring the field",
+                            format!("{}: _", name),
+                            Applicability::MachineApplicable,
+                        );
                     } else {
-                        err.span_suggestion_short_with_applicability(
-                            sp, &suggest_underscore_msg,
+                        err.span_suggestion_short(
+                            sp,
+                            &suggest_underscore_msg,
                             format!("_{}", name),
                             Applicability::MachineApplicable,
                         );
index 2d3653464d538639ee34cb8781ada5fa392abc53..34db30a1706b905b65832d9fff04e360af7e650f 100644 (file)
@@ -1526,14 +1526,14 @@ fn suggest_eliding_single_use_lifetime(
             // place ("start at" because the latter includes trailing
             // whitespace), then this is an in-band lifetime
             if decl_span.shrink_to_lo() == use_span.shrink_to_lo() {
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     use_span,
                     "elide the single-use lifetime",
                     String::new(),
                     Applicability::MachineApplicable,
                 );
             } else {
-                err.multipart_suggestion_with_applicability(
+                err.multipart_suggestion(
                     "elide the single-use lifetime",
                     vec![(decl_span, String::new()), (use_span, String::new())],
                     Applicability::MachineApplicable,
@@ -1644,7 +1644,7 @@ fn check_uses_for_lifetimes_defined_by_scope(&mut self) {
                             if let Some(generics) = self.tcx.hir().get_generics(parent_def_id) {
                                 let unused_lt_span = self.lifetime_deletion_span(name, generics);
                                 if let Some(span) = unused_lt_span {
-                                    err.span_suggestion_with_applicability(
+                                    err.span_suggestion(
                                         span,
                                         "elide the unused lifetime",
                                         String::new(),
@@ -2350,7 +2350,7 @@ fn suggest_lifetime(&self, db: &mut DiagnosticBuilder<'_>, span: Span, msg: &str
                 } else {
                     (format!("{} + 'static", snippet), Applicability::MaybeIncorrect)
                 };
-                db.span_suggestion_with_applicability(span, msg, sugg, applicability);
+                db.span_suggestion(span, msg, sugg, applicability);
                 false
             }
             Err(_) => {
index cf00bf330deea36cc7d98ea3ac11d76c10f2be14..875021e20d42041b263aee13a82c474a519597ec 100644 (file)
@@ -435,7 +435,7 @@ fn diag_once<'a, 'b>(
                 }
                 DiagnosticBuilderMethod::SpanSuggestion(suggestion) => {
                     let span = span_maybe.expect("span_suggestion_* needs a span");
-                    diag_builder.span_suggestion_with_applicability(
+                    diag_builder.span_suggestion(
                         span,
                         message,
                         suggestion,
index 1c92e2da588a0a19caac1dacf3af6ce851ee7f11..5debb119029885dcf8a18cc8dc82f6304bbc32b6 100644 (file)
@@ -904,7 +904,7 @@ fn suggest_borrow_on_unsized_slice(&self,
                 if let Some(ref expr) = local.init {
                     if let hir::ExprKind::Index(_, _) = expr.node {
                         if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(expr.span) {
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 expr.span,
                                 "consider borrowing here",
                                 format!("&{}", snippet),
@@ -952,7 +952,7 @@ fn suggest_remove_reference(&self,
                         let format_str = format!("consider removing {} leading `&`-references",
                                                  remove_refs);
 
-                        err.span_suggestion_short_with_applicability(
+                        err.span_suggestion_short(
                             sp, &format_str, String::new(), Applicability::MachineApplicable
                         );
                         break;
@@ -1109,7 +1109,7 @@ pub fn report_arg_count_mismatch(
             // For example, if `expected_args_length` is 2, suggest `|_, _|`.
             if found_args.is_empty() && is_closure {
                 let underscores = vec!["_"; expected_args.len()].join(", ");
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     pipe_span,
                     &format!(
                         "consider changing the closure to take and ignore the expected argument{}",
@@ -1130,11 +1130,12 @@ pub fn report_arg_count_mismatch(
                         .map(|(name, _)| name.to_owned())
                         .collect::<Vec<String>>()
                         .join(", ");
-                    err.span_suggestion_with_applicability(found_span,
-                                                           "change the closure to take multiple \
-                                                            arguments instead of a single tuple",
-                                                           format!("|{}|", sugg),
-                                                           Applicability::MachineApplicable);
+                    err.span_suggestion(
+                        found_span,
+                        "change the closure to take multiple arguments instead of a single tuple",
+                        format!("|{}|", sugg),
+                        Applicability::MachineApplicable,
+                    );
                 }
             }
             if let &[ArgKind::Tuple(_, ref fields)] = &expected_args[..] {
@@ -1162,12 +1163,11 @@ pub fn report_arg_count_mismatch(
                             String::new()
                         },
                     );
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         found_span,
-                        "change the closure to accept a tuple instead of \
-                         individual arguments",
+                        "change the closure to accept a tuple instead of individual arguments",
                         sugg,
-                        Applicability::MachineApplicable
+                        Applicability::MachineApplicable,
                     );
                 }
             }
index 834b541d4c01b2d2b316e7a7940cf0226625231a..f444013e2a3bdca9b48f6afeb37373b56601b7d6 100644 (file)
@@ -237,7 +237,7 @@ pub fn note_and_explain_type_err(self,
                 {
                     if let Ok(snippet) = self.sess.source_map().span_to_snippet(sp) {
                         if snippet.chars().all(|c| c.is_digit(10) || c == '-' || c == '_') {
-                            db.span_suggestion_with_applicability(
+                            db.span_suggestion(
                                 sp,
                                 "use a float literal",
                                 format!("{}.0", snippet),
index 588b2344a18e066b4b3bdce395d4b7c0d3f40101..00cbc250bd686cf19fe2235cd9fd321f68f5c455 100644 (file)
@@ -70,7 +70,7 @@ fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, errors: &[MoveErr
                 let initializer =
                     e.init.as_ref().expect("should have an initializer to get an error");
                 if let Ok(snippet) = bccx.tcx.sess.source_map().span_to_snippet(initializer.span) {
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         initializer.span,
                         "consider using a reference instead",
                         format!("&{}", snippet),
index 72963cb7e7fb4e76a99d34dd59ce70f4f5b0d4f6..5c11d622d0a8acb55e1e7c260870c97afece7d06 100644 (file)
@@ -850,7 +850,7 @@ fn report_bckerr(&self, err: &BckError<'a, 'tcx>) {
                                         }) = cmt.cat {
                                             db.note(fn_closure_msg);
                                         } else {
-                                            db.span_suggestion_with_applicability(
+                                            db.span_suggestion(
                                                 sp,
                                                 msg,
                                                 suggestion,
@@ -858,7 +858,7 @@ fn report_bckerr(&self, err: &BckError<'a, 'tcx>) {
                                             );
                                         }
                                     } else {
-                                        db.span_suggestion_with_applicability(
+                                        db.span_suggestion(
                                             sp,
                                             msg,
                                             suggestion,
@@ -1229,7 +1229,7 @@ fn note_immutability_blame(&self,
                         let let_span = self.tcx.hir().span(node_id);
                         let suggestion = suggest_ref_mut(self.tcx, let_span);
                         if let Some(replace_str) = suggestion {
-                            db.span_suggestion_with_applicability(
+                            db.span_suggestion(
                                 let_span,
                                 "use a mutable reference instead",
                                 replace_str,
@@ -1291,7 +1291,7 @@ fn note_immutable_local(&self,
                 )) = ty.map(|t| &t.node)
                 {
                     let borrow_expr_id = self.tcx.hir().get_parent_node(borrowed_node_id);
-                    db.span_suggestion_with_applicability(
+                    db.span_suggestion(
                         self.tcx.hir().span(borrow_expr_id),
                         "consider removing the `&mut`, as it is an \
                         immutable binding to a mutable reference",
@@ -1299,7 +1299,7 @@ fn note_immutable_local(&self,
                         Applicability::MachineApplicable,
                     );
                 } else {
-                    db.span_suggestion_with_applicability(
+                    db.span_suggestion(
                         let_span,
                         "make this binding mutable",
                         format!("mut {}", snippet),
@@ -1326,7 +1326,7 @@ fn report_out_of_scope_escaping_closure_capture(&self,
                                                   &cmt_path_or_string,
                                                   capture_span,
                                                   Origin::Ast)
-            .span_suggestion_with_applicability(
+            .span_suggestion(
                  err.span,
                  &format!("to force the closure to take ownership of {} \
                            (and any other referenced variables), \
index 7340c7addb50540c233005d412cbbe009f3d1b7a..5db98f0e223e484eba3a9198f7ac93cc9f28dd54 100644 (file)
@@ -78,11 +78,12 @@ fn check_unused_mut_pat(&self, pats: &[P<hir::Pat>]) {
                                      hir_id,
                                      span,
                                      "variable does not need to be mutable")
-                .span_suggestion_short_with_applicability(
+                .span_suggestion_short(
                     mut_span,
                     "remove this `mut`",
                     String::new(),
-                    Applicability::MachineApplicable)
+                    Applicability::MachineApplicable,
+                )
                 .emit();
         }
     }
index 3fa391c84ab250119cd57939e719eadd8e374b22..06a1761a1e76fb270163f8482437aa319dbdb0b3 100644 (file)
@@ -229,59 +229,7 @@ pub fn span_help<S: Into<MultiSpan>>(&mut self,
         self
     }
 
-    /// Prints out a message with a suggested edit of the code. If the suggestion is presented
-    /// inline it will only show the text message and not the text.
-    ///
-    /// See `CodeSuggestion` for more information.
-    #[deprecated(note = "Use `span_suggestion_short_with_applicability`")]
-    pub fn span_suggestion_short(&mut self, sp: Span, msg: &str, suggestion: String) -> &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::Unspecified,
-        });
-        self
-    }
-
-    /// Prints out a message with a suggested edit of the code.
-    ///
-    /// In case of short messages and a simple suggestion,
-    /// rustc displays it as a label like
-    ///
-    /// "try adding parentheses: `(tup.0).1`"
-    ///
-    /// The message
-    ///
-    /// * should not end in any punctuation (a `:` is added automatically)
-    /// * should not be a question
-    /// * should not contain any parts like "the following", "as shown"
-    /// * may look like "to do xyz, use" or "to do xyz, use abc"
-    /// * may contain a name of a function, variable or type, but not whole expressions
-    ///
-    /// See `CodeSuggestion` for more information.
-    #[deprecated(note = "Use `span_suggestion_with_applicability`")]
-    pub fn span_suggestion(&mut self, sp: Span, msg: &str, suggestion: String) -> &mut Self {
-        self.suggestions.push(CodeSuggestion {
-            substitutions: vec![Substitution {
-                parts: vec![SubstitutionPart {
-                    snippet: suggestion,
-                    span: sp,
-                }],
-            }],
-            msg: msg.to_owned(),
-            show_code_when_inline: true,
-            applicability: Applicability::Unspecified,
-        });
-        self
-    }
-
-    pub fn multipart_suggestion_with_applicability(
+    pub fn multipart_suggestion(
         &mut self,
         msg: &str,
         suggestion: Vec<(Span, String)>,
@@ -301,39 +249,24 @@ pub fn multipart_suggestion_with_applicability(
         self
     }
 
-    #[deprecated(note = "Use `multipart_suggestion_with_applicability`")]
-    pub fn multipart_suggestion(
-        &mut self,
-        msg: &str,
-        suggestion: Vec<(Span, String)>,
-    ) -> &mut Self {
-        self.multipart_suggestion_with_applicability(
-            msg,
-            suggestion,
-            Applicability::Unspecified,
-        )
-    }
-
-    /// Prints out a message with multiple suggested edits of the code.
-    #[deprecated(note = "Use `span_suggestions_with_applicability`")]
-    pub fn span_suggestions(&mut self, sp: Span, msg: &str, suggestions: Vec<String>) -> &mut Self {
-        self.suggestions.push(CodeSuggestion {
-            substitutions: suggestions.into_iter().map(|snippet| Substitution {
-                parts: vec![SubstitutionPart {
-                    snippet,
-                    span: sp,
-                }],
-            }).collect(),
-            msg: msg.to_owned(),
-            show_code_when_inline: true,
-            applicability: Applicability::Unspecified,
-        });
-        self
-    }
-
-    /// This is a suggestion that may contain mistakes or fillers and should
-    /// be read and understood by a human.
-    pub fn span_suggestion_with_applicability(&mut self, sp: Span, msg: &str,
+    /// Prints out a message with a suggested edit of the code.
+    ///
+    /// In case of short messages and a simple suggestion, rustc displays it as a label:
+    ///
+    /// ```text
+    /// try adding parentheses: `(tup.0).1`
+    /// ```
+    ///
+    /// The message
+    ///
+    /// * should not end in any punctuation (a `:` is added automatically)
+    /// * should not be a question (avoid language like "did you mean")
+    /// * should not contain any phrases like "the following", "as shown", etc.
+    /// * may look like "to do xyz, use" or "to do xyz, use abc"
+    /// * may contain a name of a function, variable, or type, but not whole expressions
+    ///
+    /// See `CodeSuggestion` for more information.
+    pub fn span_suggestion(&mut self, sp: Span, msg: &str,
                                        suggestion: String,
                                        applicability: Applicability) -> &mut Self {
         self.suggestions.push(CodeSuggestion {
@@ -350,7 +283,8 @@ pub fn span_suggestion_with_applicability(&mut self, sp: Span, msg: &str,
         self
     }
 
-    pub fn span_suggestions_with_applicability(&mut self, sp: Span, msg: &str,
+    /// Prints out a message with multiple suggested edits of the code.
+    pub fn span_suggestions(&mut self, sp: Span, msg: &str,
         suggestions: impl Iterator<Item = String>, applicability: Applicability) -> &mut Self
     {
         self.suggestions.push(CodeSuggestion {
@@ -367,7 +301,11 @@ pub fn span_suggestions_with_applicability(&mut self, sp: Span, msg: &str,
         self
     }
 
-    pub fn span_suggestion_short_with_applicability(
+    /// Prints out a message with a suggested edit of the code. If the suggestion is presented
+    /// inline, it will only show the message and not the suggestion.
+    ///
+    /// See `CodeSuggestion` for more information.
+    pub fn span_suggestion_short(
         &mut self, sp: Span, msg: &str, suggestion: String, applicability: Applicability
     ) -> &mut Self {
         self.suggestions.push(CodeSuggestion {
index 736cca6bd64af3b6399623e4b054e4b333bff7aa..f423a4cd1a7bfcd3a1a419152c3a09a2ef67f39e 100644 (file)
@@ -39,7 +39,6 @@ pub fn $n:ident(&self, $($name:ident: $ty:ty),* $(,)*) -> &Self
     ) => {
         $(#[$attrs])*
         pub fn $n(&self, $($name: $ty),*) -> &Self {
-            #[allow(deprecated)]
             self.diagnostic.$n($($name),*);
             self
         }
@@ -52,7 +51,6 @@ pub fn $n:ident(&mut self, $($name:ident: $ty:ty),* $(,)*) -> &mut Self
     ) => {
         $(#[$attrs])*
         pub fn $n(&mut self, $($name: $ty),*) -> &mut Self {
-            #[allow(deprecated)]
             self.diagnostic.$n($($name),*);
             self
         }
@@ -70,7 +68,6 @@ pub fn $n:ident<S: Into<MultiSpan>>(
     ) => {
         $(#[$attrs])*
         pub fn $n<S: Into<MultiSpan>>(&mut self, $($name: $ty),*) -> &mut Self {
-            #[allow(deprecated)]
             self.diagnostic.$n($($name),*);
             self
         }
@@ -190,53 +187,16 @@ pub fn span_label<T: Into<String>>(&mut self, span: Span, label: T) -> &mut Self
                                                   msg: &str,
                                                   ) -> &mut Self);
 
-    forward!(
-        #[deprecated(note = "Use `span_suggestion_short_with_applicability`")]
-        pub fn span_suggestion_short(
-            &mut self,
-            sp: Span,
-            msg: &str,
-            suggestion: String,
-        ) -> &mut Self
-    );
-
-    forward!(
-        #[deprecated(note = "Use `multipart_suggestion_with_applicability`")]
-        pub fn multipart_suggestion(
-            &mut self,
-            msg: &str,
-            suggestion: Vec<(Span, String)>,
-        ) -> &mut Self
-    );
-
-    forward!(
-        #[deprecated(note = "Use `span_suggestion_with_applicability`")]
-        pub fn span_suggestion(
-            &mut self,
-            sp: Span,
-            msg: &str,
-            suggestion: String,
-        ) -> &mut Self
-    );
-
-    forward!(
-        #[deprecated(note = "Use `span_suggestions_with_applicability`")]
-        pub fn span_suggestions(&mut self,
-            sp: Span,
-            msg: &str,
-            suggestions: Vec<String>,
-        ) -> &mut Self
-    );
-
-    pub fn multipart_suggestion_with_applicability(&mut self,
-                                              msg: &str,
-                                              suggestion: Vec<(Span, String)>,
-                                              applicability: Applicability,
-                                              ) -> &mut Self {
+    pub fn multipart_suggestion(
+        &mut self,
+        msg: &str,
+        suggestion: Vec<(Span, String)>,
+        applicability: Applicability,
+    ) -> &mut Self {
         if !self.allow_suggestions {
             return self
         }
-        self.diagnostic.multipart_suggestion_with_applicability(
+        self.diagnostic.multipart_suggestion(
             msg,
             suggestion,
             applicability,
@@ -244,16 +204,17 @@ pub fn multipart_suggestion_with_applicability(&mut self,
         self
     }
 
-    pub fn span_suggestion_with_applicability(&mut self,
-                                              sp: Span,
-                                              msg: &str,
-                                              suggestion: String,
-                                              applicability: Applicability)
-                                              -> &mut Self {
+    pub fn span_suggestion(
+        &mut self,
+        sp: Span,
+        msg: &str,
+        suggestion: String,
+        applicability: Applicability,
+    ) -> &mut Self {
         if !self.allow_suggestions {
             return self
         }
-        self.diagnostic.span_suggestion_with_applicability(
+        self.diagnostic.span_suggestion(
             sp,
             msg,
             suggestion,
@@ -262,16 +223,17 @@ pub fn span_suggestion_with_applicability(&mut self,
         self
     }
 
-    pub fn span_suggestions_with_applicability(&mut self,
-                                               sp: Span,
-                                               msg: &str,
-                                               suggestions: impl Iterator<Item = String>,
-                                               applicability: Applicability)
-                                               -> &mut Self {
+    pub fn span_suggestions(
+        &mut self,
+        sp: Span,
+        msg: &str,
+        suggestions: impl Iterator<Item = String>,
+        applicability: Applicability,
+    ) -> &mut Self {
         if !self.allow_suggestions {
             return self
         }
-        self.diagnostic.span_suggestions_with_applicability(
+        self.diagnostic.span_suggestions(
             sp,
             msg,
             suggestions,
@@ -280,16 +242,17 @@ pub fn span_suggestions_with_applicability(&mut self,
         self
     }
 
-    pub fn span_suggestion_short_with_applicability(&mut self,
-                                                    sp: Span,
-                                                    msg: &str,
-                                                    suggestion: String,
-                                                    applicability: Applicability)
-                                                    -> &mut Self {
+    pub fn span_suggestion_short(
+        &mut self,
+        sp: Span,
+        msg: &str,
+        suggestion: String,
+        applicability: Applicability,
+    ) -> &mut Self {
         if !self.allow_suggestions {
             return self
         }
-        self.diagnostic.span_suggestion_short_with_applicability(
+        self.diagnostic.span_suggestion_short(
             sp,
             msg,
             suggestion,
index d648472024b129203548aff2f7715a29aa6ebeb1..46e784c4099c8c87b4383dfe3b10b8c71e40a2c9 100644 (file)
@@ -78,7 +78,7 @@ fn check_expr(&mut self, cx: &LateContext, e: &hir::Expr) {
                         let msg = "denote infinite loops with `loop { ... }`";
                         let condition_span = cx.tcx.sess.source_map().def_span(e.span);
                         let mut err = cx.struct_span_lint(WHILE_TRUE, condition_span, msg);
-                        err.span_suggestion_short_with_applicability(
+                        err.span_suggestion_short(
                             condition_span,
                             "use `loop`",
                             "loop".to_owned(),
@@ -199,7 +199,7 @@ fn check_pat(&mut self, cx: &LateContext, pat: &hir::Pat) {
                                      &format!("the `{}:` in this pattern is redundant", ident));
                         let subspan = cx.tcx.sess.source_map().span_through_char(fieldpat.span,
                                                                                  ':');
-                        err.span_suggestion_short_with_applicability(
+                        err.span_suggestion_short(
                             subspan,
                             "remove this",
                             ident.to_string(),
@@ -704,7 +704,7 @@ fn check_trait_item(&mut self, cx: &EarlyContext, it: &ast::TraitItem) {
                                     arg.pat.span,
                                     "anonymous parameters are deprecated and will be \
                                      removed in the next edition."
-                                ).span_suggestion_with_applicability(
+                                ).span_suggestion(
                                     arg.pat.span,
                                     "Try naming the parameter or explicitly \
                                     ignoring it",
@@ -759,7 +759,7 @@ fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) {
                     let msg = format!("use of deprecated attribute `{}`: {}. See {}",
                                       name, reason, link);
                     let mut err = cx.struct_span_lint(DEPRECATED, attr.span, &msg);
-                    err.span_suggestion_short_with_applicability(
+                    err.span_suggestion_short(
                         attr.span,
                         suggestion.unwrap_or("remove this attribute"),
                         String::new(),
@@ -906,7 +906,7 @@ fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
                                                                   it.span,
                                                                   "functions generic over \
                                                                    types must be mangled");
-                                err.span_suggestion_short_with_applicability(
+                                err.span_suggestion_short(
                                     no_mangle_attr.span,
                                     "remove this attribute",
                                     String::new(),
@@ -934,7 +934,7 @@ fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
                         .unwrap_or(0) as u32;
                     // `const` is 5 chars
                     let const_span = it.span.with_hi(BytePos(it.span.lo().0 + start + 5));
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         const_span,
                         "try a static value",
                         "pub static".to_owned(),
@@ -1116,10 +1116,12 @@ fn perform_lint(&self, cx: &LateContext, what: &str, id: ast::NodeId,
                     "pub(crate)"
                 }.to_owned();
 
-                err.span_suggestion_with_applicability(vis.span,
-                                                       "consider restricting its visibility",
-                                                       replacement,
-                                                       applicability);
+                err.span_suggestion(
+                    vis.span,
+                    "consider restricting its visibility",
+                    replacement,
+                    applicability,
+                );
                 if exportable {
                     err.help("or consider exporting it for use by other crates");
                 }
@@ -1452,7 +1454,7 @@ fn matches_ellipsis_pat(pat: &ast::Pat) -> Option<(&P<Expr>, &P<Expr>, Span)> {
             if parenthesise {
                 *visit_subpats = false;
                 let mut err = cx.struct_span_lint(ELLIPSIS_INCLUSIVE_RANGE_PATTERNS, pat.span, msg);
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     pat.span,
                     suggestion,
                     format!("&({}..={})", expr_to_string(&start), expr_to_string(&end)),
@@ -1461,7 +1463,7 @@ fn matches_ellipsis_pat(pat: &ast::Pat) -> Option<(&P<Expr>, &P<Expr>, Span)> {
                 err.emit();
             } else {
                 let mut err = cx.struct_span_lint(ELLIPSIS_INCLUSIVE_RANGE_PATTERNS, join, msg);
-                err.span_suggestion_short_with_applicability(
+                err.span_suggestion_short(
                     join,
                     suggestion,
                     "..=".to_owned(),
@@ -1613,7 +1615,7 @@ fn check_ident(&mut self, cx: &EarlyContext, ident: ast::Ident) {
                         E0721,
                         "`await` is a keyword in the {} edition", cur_edition,
                     );
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         ident.span,
                         "you can use a raw identifier to stay compatible",
                         "r#await".to_string(),
@@ -1637,7 +1639,7 @@ fn check_ident(&mut self, cx: &EarlyContext, ident: ast::Ident) {
                      ident.as_str(),
                      next_edition),
         );
-        lint.span_suggestion_with_applicability(
+        lint.span_suggestion(
             ident.span,
             "you can use a raw identifier to stay compatible",
             format!("r#{}", ident.as_str()),
@@ -1865,7 +1867,7 @@ fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) {
                     lint_spans.clone(),
                     "outlives requirements can be inferred"
                 );
-                err.multipart_suggestion_with_applicability(
+                err.multipart_suggestion(
                     if bound_count == 1 {
                         "remove this bound"
                     } else {
index 256d28a39794e964a085a126b42ab43ad8d72524..bbf0edc6efb758c42c75e4b46068737d79d24b33 100644 (file)
@@ -93,7 +93,7 @@ fn to_camel_case(s: &str) -> String {
 
             let msg = format!("{} `{}` should have a camel case name", sort, name);
             cx.struct_span_lint(NON_CAMEL_CASE_TYPES, ident.span, &msg)
-                .span_suggestion_with_applicability(
+                .span_suggestion(
                     ident.span,
                     "convert the identifier to camel case",
                     c,
@@ -223,7 +223,7 @@ fn is_snake_case(ident: &str) -> bool {
             // We have a valid span in almost all cases, but we don't have one when linting a crate
             // name provided via the command line.
             if !ident.span.is_dummy() {
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     ident.span,
                     "convert the identifier to snake case",
                     sc,
@@ -377,7 +377,7 @@ fn check_upper_case(cx: &LateContext, sort: &str, ident: &Ident) {
 
             let msg = format!("{} `{}` should have an upper case name", sort, name);
             cx.struct_span_lint(NON_UPPER_CASE_GLOBALS, ident.span, &msg)
-                .span_suggestion_with_applicability(
+                .span_suggestion(
                     ident.span,
                     "convert the identifier to upper case",
                     uc,
index 0c4698c0254129bb22c083c0f15e17719a465462..4abd55b7e31f7d3cda737e4f41e935f08cd7e373 100644 (file)
@@ -143,7 +143,7 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx hir::Expr) {
                                                              OVERFLOWING_LITERALS,
                                                              parent_expr.span,
                                                              "only u8 can be cast into char");
-                                        err.span_suggestion_with_applicability(
+                                        err.span_suggestion(
                                             parent_expr.span,
                                             &"use a char literal instead",
                                             format!("'\\u{{{:X}}}'", lit_val),
@@ -401,7 +401,7 @@ fn report_bin_hex_error(
             {
                 if let Some(pos) = repr_str.chars().position(|c| c == 'i' || c == 'u') {
                     let (sans_suffix, _) = repr_str.split_at(pos);
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         expr.span,
                         &format!("consider using `{}` instead", sugg_ty),
                         format!("{}{}", sans_suffix, sugg_ty),
index a6cc7c2daeeecdfb13357bf44ec391d298f2c795..acf5da1e1886aa8820e241b78e0a1e7d86718808 100644 (file)
@@ -366,12 +366,12 @@ fn remove_outer_parens(cx: &EarlyContext, span: Span, pattern: &str, msg: &str)
                     _ => false,
                 }
             }).to_owned();
-        err.span_suggestion_short_with_applicability(
-                span,
-                "remove these parentheses",
-                parens_removed,
-                Applicability::MachineApplicable
-            );
+        err.span_suggestion_short(
+            span,
+            "remove these parentheses",
+            parens_removed,
+            Applicability::MachineApplicable,
+        );
         err.emit();
     }
 }
index 56b87feb82b2c34f2ce9bf93e14fe72489960f47..b070031756798b228a9e42198035cab53c4238bf 100644 (file)
@@ -1139,7 +1139,7 @@ fn report_escaping_closure_capture(
             Err(_) => "move |<args>| <body>".to_string()
         };
 
-        err.span_suggestion_with_applicability(
+        err.span_suggestion(
             args_span,
             &format!("to force the closure to take ownership of {} (and any \
                       other referenced variables), use the `move` keyword",
@@ -1428,7 +1428,7 @@ pub(super) fn report_illegal_reassignment(
         if let Some(decl) = local_decl {
             if let Some(name) = decl.name {
                 if decl.can_be_made_mutable() {
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         decl.source_info.span,
                         "make this binding mutable",
                         format!("mut {}", name),
index 9d49814c35a348056eee8f1e0aedc6bccc8ff688..5597e4a6c597e587531e28f82c2843e5b96bb57c 100644 (file)
@@ -307,7 +307,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
                 span,
                 "variable does not need to be mutable",
             )
-            .span_suggestion_short_with_applicability(
+            .span_suggestion_short(
                 mut_span,
                 "remove this `mut`",
                 String::new(),
index 3c62614ce4766f7a5e436371958f9a15e2fd51fa..8539b5c26cee88e5f8a8f4b3b3de187e430eb94a 100644 (file)
@@ -368,14 +368,14 @@ fn add_move_hints(
                     // expressions `a[b]`, which roughly desugar to
                     // `*Index::index(&a, b)` or
                     // `*IndexMut::index_mut(&mut a, b)`.
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         span,
                         "consider removing the `*`",
                         snippet[1..].to_owned(),
                         Applicability::Unspecified,
                     );
                 } else {
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         span,
                         "consider borrowing here",
                         format!("&{}", snippet),
@@ -439,7 +439,7 @@ fn add_move_error_suggestions(
         suggestions.sort_unstable_by_key(|&(span, _, _)| span);
         suggestions.dedup_by_key(|&mut (span, _, _)| span);
         for (span, to_remove, suggestion) in suggestions {
-            err.span_suggestion_with_applicability(
+            err.span_suggestion(
                 span,
                 &format!("consider removing the `{}`", to_remove),
                 suggestion,
index 63bf6faed40d462b1b65eba022ef64aef6f1e12f..4755c6daf0a773b41b37bdbd9034584fc51695f5 100644 (file)
@@ -231,7 +231,7 @@ pub(super) fn report_mutability_error(
                     base.ty(self.mir, self.infcx.tcx).to_ty(self.infcx.tcx),
                     field,
                 ) {
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         span,
                         "consider changing this to be mutable",
                         message,
@@ -285,7 +285,7 @@ pub(super) fn report_mutability_error(
                 assert_eq!(local_decl.mutability, Mutability::Not);
 
                 err.span_label(span, format!("cannot {ACT}", ACT = act));
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     local_decl.source_info.span,
                     "consider changing this to be mutable",
                     format!("mut {}", local_decl.name.unwrap()),
@@ -316,7 +316,7 @@ pub(super) fn report_mutability_error(
                         _,
                     ) = pat.node
                     {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             upvar_ident.span,
                             "consider changing this to be mutable",
                             format!("mut {}", upvar_ident.name),
@@ -410,7 +410,7 @@ pub(super) fn report_mutability_error(
                 };
 
                 if let Some((err_help_span, suggested_code)) = suggestion {
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         err_help_span,
                         &format!("consider changing this to be a mutable {}", pointer_desc),
                         suggested_code,
index 2a858bdd601aebe7f7b0c372bc02064c5fffb8fd..f07880075c100c79ddf5cbfde287f2e3825e57b5 100644 (file)
@@ -626,7 +626,7 @@ fn add_static_impl_trait_suggestion(
                             "'_".to_string()
                         };
 
-                        diag.span_suggestion_with_applicability(
+                        diag.span_suggestion(
                             span,
                             &format!(
                                 "to allow this impl Trait to capture borrowed data with lifetime \
index 10213beba2a6df74d420ecc50afdc864a32654d5..10a4575d8122066ac1e6fb3045c9e3b342a9a839 100644 (file)
@@ -313,7 +313,7 @@ fn check_for_bindings_named_same_as_variants(cx: &MatchVisitor, pat: &Pat) {
                             "pattern binding `{}` is named the same as one \
                             of the variants of the type `{}`",
                             ident, ty_path);
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             p.span,
                             "to match on the variant, qualify the path",
                             format!("{}::{}", ty_path, ident),
index d1a3d7c1f81e038343f2249c821764b10a7abe59..3b6328f320f78c96468b272fe63f0ac510e97366 100644 (file)
@@ -237,7 +237,7 @@ fn while_if_let_ambiguity(&self, expr: &P<Expr>) {
             );
 
             if let Ok(snippet) = self.session.source_map().span_to_snippet(span) {
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     span, "consider adding parentheses", format!("({})", snippet),
                     Applicability::MachineApplicable,
                 );
@@ -290,7 +290,7 @@ fn visit_expr(&mut self, expr: &'a Expr) {
                 );
                 match val.node {
                     ExprKind::Lit(ref v) if v.node.is_numeric() => {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             place.span.between(val.span),
                             "if you meant to write a comparison against a negative value, add a \
                              space in between `<` and `-`",
index 7d9165a82bc8fb52869a0a048ee00f0994ea48c4..0dcfc72d10bc053c6c98d447d8a658187d252aaa 100644 (file)
@@ -140,7 +140,7 @@ fn visit_expr(&mut self, e: &'hir hir::Expr) {
                                 .span_label(e.span,
                                             "can only break with a value inside \
                                             `loop` or breakable block")
-                                .span_suggestion_with_applicability(
+                                .span_suggestion(
                                     e.span,
                                     &format!(
                                         "instead, use `break` on its own \
index 31f8ce26225cd7223890aa13e0e27bc24bd871d4..3752d953f8afa8bd3e2cbc83e9da6bdba3e3ab44 100644 (file)
@@ -347,7 +347,7 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, parent_scope: ParentScop
                 let module = if orig_name.is_none() && ident.name == keywords::SelfLower.name() {
                     self.session
                         .struct_span_err(item.span, "`extern crate self;` requires renaming")
-                        .span_suggestion_with_applicability(
+                        .span_suggestion(
                             item.span,
                             "try",
                             "extern crate self as name;".into(),
index 873ace90172602f93b294b5ad075a4e4c4a500b8..55d5cdedd6ddd7156f561f3b4da31666746e3981 100644 (file)
@@ -247,7 +247,7 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
             let sugg_msg = "try using a local type parameter instead";
             if let Some((sugg_span, new_snippet)) = cm.generate_local_type_param_snippet(span) {
                 // Suggest the modification to the user
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     sugg_span,
                     sugg_msg,
                     new_snippet,
@@ -3175,7 +3175,7 @@ fn smart_resolve_path_fragment(&mut self,
             // Emit help message for fake-self from other languages like `this`(javascript)
             if ["this", "my"].contains(&&*item_str.as_str())
                 && this.self_value_is_available(path[0].ident.span, span) {
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     span,
                     "did you mean",
                     "self".to_string(),
@@ -3239,7 +3239,7 @@ fn smart_resolve_path_fragment(&mut self,
                     };
                     let msg = format!("{}try using the variant's enum", preamble);
 
-                    err.span_suggestions_with_applicability(
+                    err.span_suggestions(
                         span,
                         &msg,
                         enum_candidates.into_iter()
@@ -3262,7 +3262,7 @@ fn smart_resolve_path_fragment(&mut self,
                     let self_is_available = this.self_value_is_available(path[0].ident.span, span);
                     match candidate {
                         AssocSuggestion::Field => {
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 span,
                                 "try",
                                 format!("self.{}", path_str),
@@ -3275,7 +3275,7 @@ fn smart_resolve_path_fragment(&mut self,
                             }
                         }
                         AssocSuggestion::MethodWithSelf if self_is_available => {
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 span,
                                 "try",
                                 format!("self.{}", path_str),
@@ -3283,7 +3283,7 @@ fn smart_resolve_path_fragment(&mut self,
                             );
                         }
                         AssocSuggestion::MethodWithSelf | AssocSuggestion::AssocItem => {
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 span,
                                 "try",
                                 format!("Self::{}", path_str),
@@ -3304,7 +3304,7 @@ fn smart_resolve_path_fragment(&mut self,
                     "{} {} with a similar name exists",
                     suggestion.article, suggestion.kind
                 );
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     ident_span,
                     &msg,
                     suggestion.candidate.to_string(),
@@ -3318,7 +3318,7 @@ fn smart_resolve_path_fragment(&mut self,
             if let Some(def) = def {
                 match (def, source) {
                     (Def::Macro(..), _) => {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             span,
                             "use `!` to invoke the macro",
                             format!("{}!", path_str),
@@ -3335,7 +3335,7 @@ fn smart_resolve_path_fragment(&mut self,
                     }
                     (Def::Mod(..), PathSource::Expr(Some(parent))) => match parent.node {
                         ExprKind::Field(_, ident) => {
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 parent.span,
                                 "use the path separator to refer to an item",
                                 format!("{}::{}", path_str, ident),
@@ -3345,7 +3345,7 @@ fn smart_resolve_path_fragment(&mut self,
                         }
                         ExprKind::MethodCall(ref segment, ..) => {
                             let span = parent.span.with_hi(segment.ident.span.hi());
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 span,
                                 "use the path separator to refer to an item",
                                 format!("{}::{}", path_str, segment.ident),
@@ -3428,7 +3428,7 @@ fn smart_resolve_path_fragment(&mut self,
                                 PathSource::Expr(Some(parent)) => {
                                     match parent.node {
                                         ExprKind::MethodCall(ref path_assignment, _)  => {
-                                            err.span_suggestion_with_applicability(
+                                            err.span_suggestion(
                                                 sm.start_point(parent.span)
                                                   .to(path_assignment.ident.span),
                                                 "use `::` to access an associated function",
@@ -3451,7 +3451,7 @@ fn smart_resolve_path_fragment(&mut self,
                                 },
                                 PathSource::Expr(None) if followed_by_brace == true => {
                                     if let Some((sp, snippet)) = closing_brace {
-                                        err.span_suggestion_with_applicability(
+                                        err.span_suggestion(
                                             sp,
                                             "surround the struct literal with parenthesis",
                                             format!("({})", snippet),
@@ -3589,7 +3589,7 @@ fn type_ascription_suggestion(&self,
                         err.span_label(base_span,
                                        "expecting a type here because of type ascription");
                         if line_sp != line_base_sp {
-                            err.span_suggestion_short_with_applicability(
+                            err.span_suggestion_short(
                                 sp,
                                 "did you mean to use `;` here instead?",
                                 ";".to_string(),
@@ -4866,7 +4866,7 @@ fn resolve_visibility(&mut self, vis: &ast::Visibility) -> ty::Visibility {
                 } else if ident.span.rust_2018() {
                     let msg = "relative paths are not supported in visibilities on 2018 edition";
                     self.session.struct_span_err(ident.span, msg)
-                        .span_suggestion_with_applicability(
+                        .span_suggestion(
                             path.span,
                             "try",
                             format!("crate::{}", path),
@@ -5179,7 +5179,7 @@ fn report_conflict<'b>(&mut self,
 
             let rename_msg = "you can use `as` to change the binding name of the import";
             if let Some(suggestion) = suggestion {
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     binding_span,
                     rename_msg,
                     suggestion,
@@ -5302,7 +5302,7 @@ fn show_candidates(err: &mut DiagnosticBuilder,
             *candidate = format!("use {};\n{}", candidate, additional_newline);
         }
 
-        err.span_suggestions_with_applicability(
+        err.span_suggestions(
             span,
             &msg,
             path_strings.into_iter(),
index 286f9a758830b9a740b8133838e9ff22900ed95e..fb5b6c97689d0d391e6470d86697cfb9c6846793 100644 (file)
@@ -1021,14 +1021,14 @@ fn suggest_macro_name(&mut self, name: &str, kind: MacroKind,
         if let Some(suggestion) = suggestion {
             if suggestion != name {
                 if let MacroKind::Bang = kind {
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         span,
                         "you could try the macro",
                         suggestion.to_string(),
                         Applicability::MaybeIncorrect
                     );
                 } else {
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         span,
                         "try",
                         suggestion.to_string(),
index e89506aaf99f9232bc0a103c0339f63fb99f84d3..61674070fbcb23930ea95ebfc7b2f41961350e14 100644 (file)
@@ -1096,7 +1096,7 @@ fn conv_object_ty_poly_trait_ref(&self,
             if !suggestions.is_empty() {
                 let msg = format!("if you meant to specify the associated {}, write",
                     if suggestions.len() == 1 { "type" } else { "types" });
-                err.multipart_suggestion_with_applicability(
+                err.multipart_suggestion(
                     &msg,
                     suggestions,
                     Applicability::MaybeIncorrect,
@@ -1172,7 +1172,7 @@ fn report_ambiguous_associated_type(&self,
                                         trait_str: &str,
                                         name: &str) {
         struct_span_err!(self.tcx().sess, span, E0223, "ambiguous associated type")
-            .span_suggestion_with_applicability(
+            .span_suggestion(
                 span,
                 "use fully-qualified syntax",
                 format!("<{} as {}>::{}", type_str, trait_str, name),
@@ -1353,7 +1353,7 @@ pub fn associated_path_to_ty(
                         &assoc_ident.as_str(),
                         None,
                     ) {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             span,
                             "did you mean",
                             format!("{}::{}", qself_ty, suggested_name),
@@ -1407,7 +1407,7 @@ pub fn associated_path_to_ty(
             could_refer_to(variant_def, "");
             could_refer_to(def, " also");
 
-            err.span_suggestion_with_applicability(
+            err.span_suggestion(
                 span,
                 "use fully-qualified syntax",
                 format!("<{} as {}>::{}", qself_ty, "Trait", assoc_ident),
index 47f258e1aea7478d77cb28b8004bfbbf34225ced..141b8222b1f33807a4e55b373569656f88564651 100644 (file)
@@ -990,7 +990,7 @@ fn check_struct_pat_fields(&self,
                     let suggested_name =
                         find_best_match_for_name(input, &ident.as_str(), None);
                     if let Some(suggested_name) = suggested_name {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             *span,
                             "did you mean",
                             suggested_name.to_string(),
index c59c143f74b6227623321141946c611864813c28..0afc1697d316ec54638ea32976ab139cbc8ba598 100644 (file)
@@ -269,7 +269,7 @@ fn confirm_builtin_call(
                     );
 
                     if let Some(ref path) = unit_variant {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             call_expr.span,
                             &format!(
                                 "`{}` is a unit variant, you need to write it \
@@ -294,7 +294,7 @@ fn confirm_builtin_call(
                                 self.tcx.sess.source_map().is_multiline(call_expr.span);
                             if call_is_multiline {
                                 let span = self.tcx.sess.source_map().next_point(callee.span);
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     span,
                                     "try adding a semicolon",
                                     ";".to_owned(),
index 3f185ba194903f068cd8e7571b18239f8bc30c8d..85cae17fd85244a1baa8ba0905cc5d7ecc340696 100644 (file)
@@ -213,7 +213,7 @@ fn report_cast_error(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>, e: CastError) {
                                        fcx.ty_to_string(self.expr_ty),
                                        cast_ty));
                 if let Ok(snippet) = fcx.sess().source_map().span_to_snippet(self.expr.span) {
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         self.expr.span,
                         "dereference the expression",
                         format!("*{}", snippet),
@@ -263,7 +263,7 @@ fn report_cast_error(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>, e: CastError) {
                 if self.expr_ty.is_numeric() {
                     match fcx.tcx.sess.source_map().span_to_snippet(self.expr.span) {
                         Ok(snippet) => {
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 self.span,
                                 "compare with zero instead",
                                 format!("{} != 0", snippet),
@@ -314,7 +314,7 @@ fn report_cast_error(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>, e: CastError) {
                 err.note("The type information given here is insufficient to check whether \
                           the pointer cast is valid");
                 if unknown_cast_to {
-                    err.span_suggestion_short_with_applicability(
+                    err.span_suggestion_short(
                         self.cast_span,
                         "consider giving more type information",
                         String::new(),
@@ -345,7 +345,7 @@ fn report_cast_to_unsized_type(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) {
                 if self.cast_ty.is_trait() {
                     match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) {
                         Ok(s) => {
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 self.cast_span,
                                 "try casting to a reference instead",
                                 format!("&{}{}", mtstr, s),
@@ -367,7 +367,7 @@ fn report_cast_to_unsized_type(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) {
             ty::Adt(def, ..) if def.is_box() => {
                 match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) {
                     Ok(s) => {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             self.cast_span,
                             "try casting to a `Box` instead",
                             format!("Box<{}>", s),
index 8c193cc8ff1a3b790debb2eb566d6698a77140f9..0eb8d7d06b1f68a072c32496e3ee1a6e03001b11 100644 (file)
@@ -316,7 +316,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                 if let Some(trait_err_span) = trait_err_span {
                     if let Ok(trait_err_str) = tcx.sess.source_map()
                                                        .span_to_snippet(trait_err_span) {
-                        diag.span_suggestion_with_applicability(
+                        diag.span_suggestion(
                             impl_err_span,
                             "consider change the type to match the mutability in trait",
                             trait_err_str,
@@ -784,7 +784,7 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                             .span_to_snippet(trait_m.generics.span)
                             .ok()?;
 
-                        err.multipart_suggestion_with_applicability(
+                        err.multipart_suggestion(
                             "try changing the `impl Trait` argument to a generic parameter",
                             vec![
                                 // replace `impl Trait` with `T`
@@ -855,7 +855,7 @@ fn nested_visit_map<'this>(
                             .span_to_snippet(bounds)
                             .ok()?;
 
-                        err.multipart_suggestion_with_applicability(
+                        err.multipart_suggestion(
                             "try removing the generic parameter and using `impl Trait` instead",
                             vec![
                                 // delete generic parameters
index d985bdae491d09d6d2dd40f47a648b632cce65cb..0d4690c83170ace3b1f8892226b673fe1a2b70d7 100644 (file)
@@ -143,7 +143,7 @@ pub fn demand_coerce_diag(&self,
                     let expr_text = print::to_string(print::NO_ANN, |s| s.print_expr(expr));
                     let suggestions = compatible_variants
                         .map(|v| format!("{}({})", v, expr_text));
-                    err.span_suggestions_with_applicability(
+                    err.span_suggestions(
                         expr.span,
                         "try using a variant of the expected type",
                         suggestions,
@@ -558,7 +558,7 @@ pub fn check_for_cast(
                     if needs_paren { ")" } else { "" },
                 );
 
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     expr.span,
                     &suggest_msg,
                     if literal_is_ty_suffixed(expr) {
@@ -575,7 +575,7 @@ pub fn check_for_cast(
                     match (found.bit_width(), exp.bit_width()) {
                         (Some(found), Some(exp)) if found > exp => {
                             if can_cast {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, will_truncate),
                                     cast_suggestion,
@@ -585,7 +585,7 @@ pub fn check_for_cast(
                         }
                         (None, _) | (_, None) => {
                             if can_cast {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, depending_on_isize),
                                     cast_suggestion,
@@ -606,7 +606,7 @@ pub fn check_for_cast(
                     match (found.bit_width(), exp.bit_width()) {
                         (Some(found), Some(exp)) if found > exp => {
                             if can_cast {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, will_truncate),
                                     cast_suggestion,
@@ -616,7 +616,7 @@ pub fn check_for_cast(
                         }
                         (None, _) | (_, None) => {
                             if can_cast {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, depending_on_usize),
                                     cast_suggestion,
@@ -637,7 +637,7 @@ pub fn check_for_cast(
                     if can_cast {
                         match (found.bit_width(), exp.bit_width()) {
                             (Some(found), Some(exp)) if found > exp - 1 => {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, will_truncate),
                                     cast_suggestion,
@@ -645,7 +645,7 @@ pub fn check_for_cast(
                                 );
                             }
                             (None, None) => {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, will_truncate),
                                     cast_suggestion,
@@ -653,7 +653,7 @@ pub fn check_for_cast(
                                 );
                             }
                             (None, _) => {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, depending_on_isize),
                                     cast_suggestion,
@@ -661,7 +661,7 @@ pub fn check_for_cast(
                                 );
                             }
                             (_, None) => {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, depending_on_usize),
                                     cast_suggestion,
@@ -669,7 +669,7 @@ pub fn check_for_cast(
                                 );
                             }
                             _ => {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, will_zero_extend),
                                     cast_suggestion,
@@ -684,7 +684,7 @@ pub fn check_for_cast(
                     if can_cast {
                         match (found.bit_width(), exp.bit_width()) {
                             (Some(found), Some(exp)) if found - 1 > exp => {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, will_truncate),
                                     cast_suggestion,
@@ -692,7 +692,7 @@ pub fn check_for_cast(
                                 );
                             }
                             (None, None) => {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, will_sign_extend),
                                     cast_suggestion,
@@ -700,7 +700,7 @@ pub fn check_for_cast(
                                 );
                             }
                             (None, _) => {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, depending_on_usize),
                                     cast_suggestion,
@@ -708,7 +708,7 @@ pub fn check_for_cast(
                                 );
                             }
                             (_, None) => {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, depending_on_isize),
                                     cast_suggestion,
@@ -716,7 +716,7 @@ pub fn check_for_cast(
                                 );
                             }
                             _ => {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     expr.span,
                                     &format!("{}, which {}", msg, will_sign_extend),
                                     cast_suggestion,
@@ -734,7 +734,7 @@ pub fn check_for_cast(
                            None,
                        );
                     } else if can_cast {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             expr.span,
                             &format!("{}, producing the closest possible value", msg),
                             cast_suggestion,
@@ -745,7 +745,7 @@ pub fn check_for_cast(
                 }
                 (&ty::Uint(_), &ty::Float(_)) | (&ty::Int(_), &ty::Float(_)) => {
                     if can_cast {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             expr.span,
                             &format!("{}, rounding the float towards zero", msg),
                             cast_suggestion,
@@ -760,7 +760,7 @@ pub fn check_for_cast(
                 (&ty::Float(ref exp), &ty::Uint(ref found)) => {
                     // if `found` is `None` (meaning found is `usize`), don't suggest `.into()`
                     if exp.bit_width() > found.bit_width().unwrap_or(256) {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             expr.span,
                             &format!("{}, producing the floating point representation of the \
                                       integer",
@@ -769,7 +769,8 @@ pub fn check_for_cast(
                             Applicability::MachineApplicable
                         );
                     } else if can_cast {
-                        err.span_suggestion_with_applicability(expr.span,
+                        err.span_suggestion(
+                            expr.span,
                             &format!("{}, producing the floating point representation of the \
                                       integer, rounded if necessary",
                                      msg),
@@ -782,7 +783,7 @@ pub fn check_for_cast(
                 (&ty::Float(ref exp), &ty::Int(ref found)) => {
                     // if `found` is `None` (meaning found is `isize`), don't suggest `.into()`
                     if exp.bit_width() > found.bit_width().unwrap_or(256) {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             expr.span,
                             &format!("{}, producing the floating point representation of the \
                                       integer",
@@ -791,7 +792,7 @@ pub fn check_for_cast(
                             Applicability::MachineApplicable
                         );
                     } else if can_cast {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             expr.span,
                             &format!("{}, producing the floating point representation of the \
                                       integer, rounded if necessary",
index e71dc019471bdc3d2cf85fc0f0ce779561e89a2f..b7d015729b42dab984b17c9f808ac1b3d6f783cd 100644 (file)
@@ -157,7 +157,7 @@ pub fn method_exists(&self,
             (format!("{}()", method_name), Applicability::MaybeIncorrect)
         };
 
-        err.span_suggestion_with_applicability(method_name.span, msg, suggestion, applicability);
+        err.span_suggestion(method_name.span, msg, suggestion, applicability);
     }
 
     /// Performs method lookup. If lookup is successful, it will return the callee
index b849be52a9223fe7f4e210f3ad25177583c96e2e..623677482db34300c855531b7f53ea88aa69ab7a 100644 (file)
@@ -1144,7 +1144,7 @@ fn emit_unstable_name_collision_hint(
             "a method with this name may be added to the standard library in the future",
         );
 
-        // FIXME: This should be a `span_suggestion_with_applicability` instead of `help`
+        // FIXME: This should be a `span_suggestion` instead of `help`
         // However `self.span` only
         // highlights the method name, so we can't use it. Also consider reusing the code from
         // `report_method_error()`.
index f71a163cee26156b813ee12dbb0126837c5dcdeb..55b6e8f099ea96e53b76a11548ff4d87ecb1dfa6 100644 (file)
@@ -237,15 +237,12 @@ pub fn report_method_error<'b>(&self,
                                 let snippet = tcx.sess.source_map().span_to_snippet(lit.span)
                                     .unwrap_or_else(|_| "<numeric literal>".to_owned());
 
-                                err.span_suggestion_with_applicability(
-                                                    lit.span,
-                                                    &format!("you must specify a concrete type for \
-                                                              this numeric value, like `{}`",
-                                                             concrete_type),
-                                                    format!("{}_{}",
-                                                            snippet,
-                                                            concrete_type),
-                                                    Applicability::MaybeIncorrect,
+                                err.span_suggestion(
+                                    lit.span,
+                                    &format!("you must specify a concrete type for \
+                                              this numeric value, like `{}`", concrete_type),
+                                    format!("{}_{}", snippet, concrete_type),
+                                    Applicability::MaybeIncorrect,
                                 );
                             }
                             ExprKind::Path(ref qpath) => {
@@ -271,7 +268,7 @@ pub fn report_method_error<'b>(&self,
                                                 ty,
                                                 ..
                                             })) => {
-                                                err.span_suggestion_with_applicability(
+                                                err.span_suggestion(
                                                     // account for `let x: _ = 42;`
                                                     //                  ^^^^
                                                     span.to(ty.as_ref().map(|ty| ty.span)
@@ -304,7 +301,7 @@ pub fn report_method_error<'b>(&self,
                         );
                         if let Some(suggestion) = suggestion {
                             // enum variant
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 item_name.span,
                                 "did you mean",
                                 suggestion.to_string(),
@@ -404,7 +401,7 @@ macro_rules! report_function {
                 }
                 if static_sources.len() == 1 {
                     if let SelfSource::MethodCall(expr) = source {
-                        err.span_suggestion_with_applicability(expr.span.to(span),
+                        err.span_suggestion(expr.span.to(span),
                                             "use associated function syntax instead",
                                             format!("{}::{}",
                                                     self.ty_to_string(actual),
@@ -445,7 +442,7 @@ macro_rules! report_function {
                 }
 
                 if let Some(lev_candidate) = lev_candidate {
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         span,
                         "did you mean",
                         lev_candidate.ident.to_string(),
@@ -522,12 +519,7 @@ fn suggest_use_candidates(&self,
                 )
             });
 
-            err.span_suggestions_with_applicability(
-                                                    span,
-                                                    &msg,
-                                                    path_strings,
-                                                    Applicability::MaybeIncorrect,
-            );
+            err.span_suggestions(span, &msg, path_strings, Applicability::MaybeIncorrect);
         } else {
             let limit = if candidates.len() == 5 { 5 } else { 4 };
             for (i, trait_did) in candidates.iter().take(limit).enumerate() {
index 240db801fb2f22c4ffd6d91ff6bd27e97263ed10..c94713980d8c06e3a97ed6e46c5934a64d845efa 100644 (file)
@@ -2903,7 +2903,7 @@ fn check_argument_types(&self,
                 let sugg_span = tcx.sess.source_map().end_point(expr_sp);
                 // remove closing `)` from the span
                 let sugg_span = sugg_span.shrink_to_lo();
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     sugg_span,
                     "expected the unit value `()`; create it with empty parentheses",
                     String::from("()"),
@@ -3170,7 +3170,7 @@ fn check_expr_meets_expectation_or_error(&self,
                     self.tcx.sess.source_map().span_to_snippet(lhs.span),
                     self.tcx.sess.source_map().span_to_snippet(rhs.span))
                 {
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         expr.span,
                         msg,
                         format!("{} == {}", left, right),
@@ -3587,7 +3587,7 @@ fn check_field(&self,
                         if let Some(suggested_field_name) =
                             Self::suggest_field_name(def.non_enum_variant(),
                                                      &field.as_str(), vec![]) {
-                                err.span_suggestion_with_applicability(
+                                err.span_suggestion(
                                     field.span,
                                     "a field with a similar name exists",
                                     suggested_field_name.to_string(),
@@ -3618,7 +3618,7 @@ fn check_field(&self,
                             } else {
                                 Applicability::MaybeIncorrect
                             };
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 expr.span, help, suggestion, applicability
                             );
                         }
@@ -3629,7 +3629,7 @@ fn check_field(&self,
                             .unwrap_or_else(|_| self.tcx.hir().node_to_pretty_string(base.id));
                         let msg = format!("`{}` is a raw pointer; try dereferencing it", base);
                         let suggestion = format!("(*{}).{}", base, field);
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             expr.span,
                             &msg,
                             suggestion,
@@ -3719,12 +3719,12 @@ fn report_unknown_field(&self,
         if let Some(field_name) = Self::suggest_field_name(variant,
                                                            &field.ident.as_str(),
                                                            skip_fields.collect()) {
-            err.span_suggestion_with_applicability(
-                    field.ident.span,
-                    "a field with a similar name exists",
-                    field_name.to_string(),
-                    Applicability::MaybeIncorrect,
-                );
+            err.span_suggestion(
+                field.ident.span,
+                "a field with a similar name exists",
+                field_name.to_string(),
+                Applicability::MaybeIncorrect,
+            );
         } else {
             match ty.sty {
                 ty::Adt(adt, ..) => {
@@ -4670,11 +4670,12 @@ fn check_expr_kind(
                                             ast::LitIntType::Unsuffixed) = lit.node {
                                         let snip = tcx.sess.source_map().span_to_snippet(base.span);
                                         if let Ok(snip) = snip {
-                                            err.span_suggestion_with_applicability(
+                                            err.span_suggestion(
                                                 expr.span,
                                                 "to access tuple elements, use",
                                                 format!("{}.{}", snip, i),
-                                                Applicability::MachineApplicable);
+                                                Applicability::MachineApplicable,
+                                            );
                                             needs_note = false;
                                         }
                                     }
@@ -5106,7 +5107,7 @@ pub fn suggest_ref_or_into(
         found: Ty<'tcx>,
     ) {
         if let Some((sp, msg, suggestion)) = self.check_ref(expr, found, expected) {
-            err.span_suggestion_with_applicability(
+            err.span_suggestion(
                 sp,
                 msg,
                 suggestion,
@@ -5133,7 +5134,7 @@ pub fn suggest_ref_or_into(
                         }
                     }).peekable();
                 if suggestions.peek().is_some() {
-                    err.span_suggestions_with_applicability(
+                    err.span_suggestions(
                         expr.span,
                         "try using a conversion method",
                         suggestions,
@@ -5172,7 +5173,7 @@ fn suggest_missing_semicolon(&self,
                 ExprKind::Match(..) |
                 ExprKind::Block(..) => {
                     let sp = self.tcx.sess.source_map().next_point(cause_span);
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         sp,
                         "try adding a semicolon",
                         ";".to_string(),
@@ -5206,7 +5207,7 @@ fn suggest_missing_return_type(
         // haven't set a return type at all (and aren't `fn main()` or an impl).
         match (&fn_decl.output, found.is_suggestable(), can_suggest, expected.is_unit()) {
             (&hir::FunctionRetTy::DefaultReturn(span), true, true, true) => {
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     span,
                     "try adding a return type",
                     format!("-> {} ", self.resolve_type_vars_with_obligations(found)),
@@ -5260,7 +5261,7 @@ fn consider_hint_about_removing_semicolon(
         err: &mut DiagnosticBuilder,
     ) {
         if let Some(span_semi) = self.could_remove_semicolon(blk, expected_ty) {
-            err.span_suggestion_with_applicability(
+            err.span_suggestion(
                 span_semi,
                 "consider removing this semicolon",
                 String::new(),
@@ -5436,7 +5437,7 @@ pub fn instantiate_value_path(&self,
                                 },
                                 AdtKind::Struct |
                                 AdtKind::Union => {
-                                    err.span_suggestion_with_applicability(
+                                    err.span_suggestion(
                                         span,
                                         "use curly brackets",
                                         String::from("Self { /* fields */ }"),
index 7c871601af3088bc29672c15dfec74c865c40735..5efa9f08404d91fa38203c0cf569a1c734d0bed2 100644 (file)
@@ -280,7 +280,7 @@ fn check_overloaded_binop(&self,
                                             rty,
                                             lstring,
                                         );
-                                        err.span_suggestion_with_applicability(
+                                        err.span_suggestion(
                                             lhs_expr.span,
                                             msg,
                                             format!("*{}", lstring),
@@ -434,7 +434,7 @@ fn check_str_addition(
                     err.span_label(expr.span,
                                    "`+` can't be used to concatenate two `&str` strings");
                     match source_map.span_to_snippet(lhs_expr.span) {
-                        Ok(lstring) => err.span_suggestion_with_applicability(
+                        Ok(lstring) => err.span_suggestion(
                             lhs_expr.span,
                             msg,
                             format!("{}.to_owned()", lstring),
@@ -455,7 +455,7 @@ fn check_str_addition(
                     is_assign,
                 ) {
                     (Ok(l), Ok(r), false) => {
-                        err.multipart_suggestion_with_applicability(
+                        err.multipart_suggestion(
                             msg,
                             vec![
                                 (lhs_expr.span, format!("{}.to_owned()", l)),
index bf767726ef715d9f2321aecf4c6fd1c4c7ae9999..a7e19fc4237ccf00474b79dd4fb0f86ce29952e9 100644 (file)
@@ -136,7 +136,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) {
                     .fold(span, |acc, attr_span| acc.to(attr_span));
 
                 tcx.struct_span_lint_node(lint, id, span, msg)
-                    .span_suggestion_short_with_applicability(
+                    .span_suggestion_short(
                         span_with_attrs,
                         "remove it",
                         String::new(),
@@ -178,7 +178,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) {
         };
         let replacement = visibility_qualified(&item.vis, base_replacement);
         tcx.struct_span_lint_node(lint, id, extern_crate.span, msg)
-            .span_suggestion_short_with_applicability(
+            .span_suggestion_short(
                 extern_crate.span,
                 &help,
                 replacement,
index 7e1ef8e021350b77bc6f86ac0591553901dcae36..f75ab47e1ab70d14599d6f4653f9c10ecddb9205 100644 (file)
@@ -63,7 +63,7 @@ fn common(&self) -> DiagnosticBuilder<'tcx> {
             )
         };
         if let Ok(snippet) = self.sess.source_map().span_to_snippet(self.span) {
-            err.span_suggestion_with_applicability(
+            err.span_suggestion(
                 self.span,
                 &format!("cast the value to `{}`", self.cast_ty),
                 format!("{} as {}", snippet, self.cast_ty),
index a013cc36c722dd3bf7343e0e7aa6401bc95e9ca6..8ccd55c17d060d19e69665eb7dff39173b333843 100644 (file)
@@ -62,7 +62,7 @@ fn check_rust_syntax(&self, item: &clean::Item, dox: &str, code_block: RustCodeB
 
                 if code_block.syntax.is_none() && code_block.is_fenced {
                     let sp = sp.from_inner_byte_pos(0, 3);
-                    diag.span_suggestion_with_applicability(
+                    diag.span_suggestion(
                         sp,
                         "mark blocks that do not contain Rust code as text",
                         String::from("```text"),
index 1a4b45e76b42dcab6536493e2699b1eabfe77a42..08c7c617a7bef15725226ef9272e7d5afc164ad9 100644 (file)
@@ -42,7 +42,7 @@ fn handle_errors(sess: &ParseSess, span: Span, error: AttrError) {
             let mut err = struct_span_err!(diag, span, E0565, "{}", msg);
             if is_bytestr {
                 if let Ok(lint_str) = sess.source_map().span_to_snippet(span) {
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         span,
                         "consider removing the prefix",
                         format!("{}", &lint_str[1..]),
@@ -794,7 +794,7 @@ pub fn find_repr_attrs(sess: &ParseSess, attr: &Attribute) -> Vec<ReprAttr> {
                                     "incorrect `repr(align)` attribute format");
                                 match value.node {
                                     ast::LitKind::Int(int, ast::LitIntType::Unsuffixed) => {
-                                        err.span_suggestion_with_applicability(
+                                        err.span_suggestion(
                                             item.span,
                                             "use parentheses instead",
                                             format!("align({})", int),
@@ -802,7 +802,7 @@ pub fn find_repr_attrs(sess: &ParseSess, attr: &Attribute) -> Vec<ReprAttr> {
                                         );
                                     }
                                     ast::LitKind::Str(s, _) => {
-                                        err.span_suggestion_with_applicability(
+                                        err.span_suggestion(
                                             item.span,
                                             "use parentheses instead",
                                             format!("align({})", s),
index 50e0056f3b9f1ebca653cd7fedd65ded9ca85264..2930ce079c848a58a58dc31da9686164e185f949 100644 (file)
@@ -155,7 +155,7 @@ pub fn in_cfg(&mut self, attrs: &[ast::Attribute]) -> bool {
             let error = |span, msg, suggestion: &str| {
                 let mut err = self.sess.span_diagnostic.struct_span_err(span, msg);
                 if !suggestion.is_empty() {
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         span,
                         "expected syntax is",
                         suggestion.into(),
index 9369e66cf83da7368010c9a576da19a2f3d75835..d1f7b4df9bea42bbecfa63dc5d1f944f444e2809 100644 (file)
@@ -361,7 +361,7 @@ fn expand_fragment(&mut self, input_fragment: AstFragment) -> AstFragment {
                             let trait_list = traits.iter()
                                 .map(|t| t.to_string()).collect::<Vec<_>>();
                             let suggestion = format!("#[derive({})]", trait_list.join(", "));
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 span, "try an outer attribute", suggestion,
                                 // We don't 𝑘𝑛𝑜𝑤 that the following item is an ADT
                                 Applicability::MaybeIncorrect
@@ -1043,7 +1043,7 @@ pub fn ensure_complete_parse(&mut self, macro_path: &Path, kind_name: &str, span
             let semi_full_span = semi_span.to(self.sess.source_map().next_point(semi_span));
             match self.sess.source_map().span_to_snippet(semi_full_span) {
                 Ok(ref snippet) if &snippet[..] != ";" && kind_name == "expression" => {
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         semi_span,
                         "you might be missing a semicolon here",
                         ";".to_owned(),
@@ -1574,7 +1574,7 @@ fn fold_attribute(&mut self, at: ast::Attribute) -> Option<ast::Attribute> {
                         _ => (String::from("<path>"), Applicability::HasPlaceholders),
                     };
 
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         it.span,
                         "provide a file path with `=`",
                         format!("include = \"{}\"", path),
index 9a129e7e8fcd8c7df0efa8bd733c674d79af8f39..176575b67ea92f1530a1b301deaa645b73bdbcfb 100644 (file)
@@ -221,7 +221,7 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt,
                     if comma_span.is_dummy() {
                         err.note("you might be missing a comma");
                     } else {
-                        err.span_suggestion_short_with_applicability(
+                        err.span_suggestion_short(
                             comma_span,
                             "missing comma here",
                             ", ".to_string(),
index 8827e04802c332edd6e748adb52141f18b3b917d..06f9162a400f66f3794e4c18f56ba4eb1998bb0a 100644 (file)
@@ -949,7 +949,7 @@ fn scan_char_or_byte(&mut self,
                                     }
                                     if i != 0 {
                                         suggestion.push('}');
-                                        err.span_suggestion_with_applicability(
+                                        err.span_suggestion(
                                             self.mk_sp(start, self.pos),
                                             "format of unicode escape sequences uses braces",
                                             suggestion,
@@ -1427,7 +1427,7 @@ fn next_token_inner(&mut self) -> Result<token::Token, ()> {
                             self.sess.span_diagnostic
                                 .struct_span_err(span,
                                                  "character literal may only contain one codepoint")
-                                .span_suggestion_with_applicability(
+                                .span_suggestion(
                                     span,
                                     "if you meant to write a `str` literal, use double quotes",
                                     format!("\"{}\"", &self.src[start..end]),
index c31756714a6c3257005e7204ad00881fb25c4bb2..7da4284c0e4aac4c33ad8bedbcd4a809d0db14b9 100644 (file)
                 let msg =
                     format!("Unicode character '{}' ({}) looks like '{}' ({}), but it is not",
                             ch, u_name, ascii_char, ascii_name);
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     span,
                     &msg,
                     ascii_char.to_string(),
index 92da05a648152c04f84fdce10bd765139c29f699..65572102c5981f11b93369fc7da9043b9fb62682 100644 (file)
@@ -736,7 +736,7 @@ fn tokens_to_string(tokens: &[TokenType]) -> String {
             };
             let mut err = self.fatal(&msg_exp);
             if self.token.is_ident_named("and") {
-                err.span_suggestion_short_with_applicability(
+                err.span_suggestion_short(
                     self.span,
                     "use `&&` instead of `and` for the boolean operator",
                     "&&".to_string(),
@@ -744,7 +744,7 @@ fn tokens_to_string(tokens: &[TokenType]) -> String {
                 );
             }
             if self.token.is_ident_named("or") {
-                err.span_suggestion_short_with_applicability(
+                err.span_suggestion_short(
                     self.span,
                     "use `||` instead of `or` for the boolean operator",
                     "||".to_string(),
@@ -810,7 +810,7 @@ fn expected_ident_found(&self) -> DiagnosticBuilder<'a> {
             if ident.is_reserved() && !ident.is_path_segment_keyword() &&
                 ident.name != keywords::Underscore.name()
             {
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     self.span,
                     "you can escape reserved keywords to use them as identifiers",
                     format!("r#{}", ident),
@@ -823,7 +823,7 @@ fn expected_ident_found(&self) -> DiagnosticBuilder<'a> {
         } else {
             err.span_label(self.span, "expected identifier");
             if self.token == token::Comma && self.look_ahead(1, |t| t.is_ident()) {
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     self.span,
                     "remove this comma",
                     String::new(),
@@ -1696,7 +1696,7 @@ fn maybe_report_ambiguous_plus(&mut self, allow_plus: bool, impl_dyn_multi: bool
         if !allow_plus && impl_dyn_multi {
             let sum_with_parens = format!("({})", pprust::ty_to_string(&ty));
             self.struct_span_err(ty.span, "ambiguous `+` in a type")
-                .span_suggestion_with_applicability(
+                .span_suggestion(
                     ty.span,
                     "use parentheses to disambiguate",
                     sum_with_parens,
@@ -1731,7 +1731,7 @@ fn maybe_recover_from_bad_type_plus(&mut self, allow_plus: bool, ty: &Ty) -> PRe
                     s.print_type_bounds(" +", &bounds)?;
                     s.pclose()
                 });
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     sum_span,
                     "try adding parentheses",
                     sum_with_parens,
@@ -1774,7 +1774,7 @@ fn maybe_recover_from_bad_qpath<T: RecoverQPath>(&mut self, base: T, allow_recov
 
         self.diagnostic()
             .struct_span_err(span, "missing angle brackets in associated item path")
-            .span_suggestion_with_applicability( // this is a best-effort recovery
+            .span_suggestion( // this is a best-effort recovery
                 span, "try", recovered.to_string(), Applicability::MaybeIncorrect
             ).emit();
 
@@ -1878,7 +1878,7 @@ fn parse_arg_general(&mut self, require_name: bool, is_trait_item: bool) -> PRes
                     let ident = self.parse_ident().unwrap();
                     let span = pat.span.with_hi(ident.span.hi());
 
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         span,
                         "declare the type after the parameter binding",
                         String::from("<identifier>: <type>"),
@@ -1886,7 +1886,7 @@ fn parse_arg_general(&mut self, require_name: bool, is_trait_item: bool) -> PRes
                     );
                 } else if require_name && is_trait_item {
                     if let PatKind::Ident(_, ident, _) = pat.node {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             pat.span,
                             "explicitly ignore parameter",
                             format!("_: {}", ident),
@@ -1937,7 +1937,7 @@ fn parse_arg_general(&mut self, require_name: bool, is_trait_item: bool) -> PRes
                         "patterns aren't allowed in methods without bodies",
                         DiagnosticId::Error("E0642".into()),
                     );
-                    err.span_suggestion_short_with_applicability(
+                    err.span_suggestion_short(
                         pat.span,
                         "give this argument a name or use an underscore to ignore it",
                         "_".to_owned(),
@@ -2034,7 +2034,7 @@ fn parse_lit_token(&mut self) -> PResult<'a, LitKind> {
                     let sp = lo.to(self.prev_span);
                     let mut err = self.diagnostic()
                         .struct_span_err(sp, "float literals must have an integer part");
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         sp,
                         "must have an integer part",
                         format!("0.{}{}", val, suffix),
@@ -2365,7 +2365,7 @@ fn parse_field(&mut self) -> PResult<'a, Field> {
             if self.token == token::Eq {
                 self.diagnostic()
                     .struct_span_err(self.span, "expected `:`, found `=`")
-                    .span_suggestion_with_applicability(
+                    .span_suggestion(
                         fieldname.span.shrink_to_hi().to(self.span),
                         "replace equals symbol with a colon",
                         ":".to_string(),
@@ -2751,7 +2751,7 @@ fn parse_struct_expr(&mut self, lo: Span, pth: ast::Path, mut attrs: ThinVec<Att
                         exp_span.to(self.prev_span),
                         "cannot use a comma after the base struct",
                     );
-                    err.span_suggestion_short_with_applicability(
+                    err.span_suggestion_short(
                         self.span,
                         "remove this comma",
                         String::new(),
@@ -3019,7 +3019,7 @@ fn check_trailing_angle_brackets(&mut self, segment: &PathSegment, end: token::T
                     span,
                     &format!("unmatched angle bracket{}", if plural { "s" } else { "" }),
                 )
-                .span_suggestion_with_applicability(
+                .span_suggestion(
                     span,
                     &format!("remove extra angle bracket{}", if plural { "s" } else { "" }),
                     String::new(),
@@ -3072,7 +3072,7 @@ fn parse_dot_or_call_expr_with_(&mut self, e0: P<Expr>, lo: Span) -> PResult<'a,
                             s.s.word(".")?;
                             s.s.word(fstr.splitn(2, ".").last().unwrap().to_string())
                         });
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             lo.to(self.prev_span),
                             "try parenthesizing the first index",
                             sugg,
@@ -3219,7 +3219,7 @@ fn parse_prefix_expr(&mut self,
                 let span_of_tilde = lo;
                 let mut err = self.diagnostic()
                     .struct_span_err(span_of_tilde, "`~` cannot be used as a unary operator");
-                err.span_suggestion_short_with_applicability(
+                err.span_suggestion_short(
                     span_of_tilde,
                     "use `!` to perform bitwise negation",
                     "!".to_owned(),
@@ -3292,7 +3292,7 @@ fn parse_prefix_expr(&mut self,
                     // trailing whitespace after the `!` in our suggestion
                     let to_replace = self.sess.source_map()
                         .span_until_non_whitespace(lo.to(self.span));
-                    err.span_suggestion_short_with_applicability(
+                    err.span_suggestion_short(
                         to_replace,
                         "use `!` to perform logical negation",
                         "!".to_owned(),
@@ -3393,7 +3393,7 @@ fn parse_assoc_expr_with(&mut self,
                         let cur_pos = cm.lookup_char_pos(self.span.lo());
                         let op_pos = cm.lookup_char_pos(cur_op_span.hi());
                         if cur_pos.line != op_pos.line {
-                            err.span_suggestion_with_applicability(
+                            err.span_suggestion(
                                 cur_op_span,
                                 "try using a semicolon",
                                 ";".to_string(),
@@ -3552,7 +3552,7 @@ fn parse_assoc_op_cast(&mut self, lhs: P<Expr>, lhs_span: Span,
 
                         let expr_str = self.sess.source_map().span_to_snippet(expr.span)
                                                 .unwrap_or_else(|_| pprust::expr_to_string(&expr));
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             expr.span,
                             &format!("try {} the cast value", op_verb),
                             format!("({})", expr_str),
@@ -3768,7 +3768,7 @@ fn parse_for_expr(&mut self, opt_label: Option<Label>,
             let in_span = self.prev_span.between(self.span);
             let mut err = self.sess.span_diagnostic
                 .struct_span_err(in_span, "missing `in` in `for` loop");
-            err.span_suggestion_short_with_applicability(
+            err.span_suggestion_short(
                 in_span, "try adding `in` here", " in ".into(),
                 // has been misleading, at least in the past (closed Issue #48492)
                 Applicability::MaybeIncorrect
@@ -3782,7 +3782,7 @@ fn parse_for_expr(&mut self, opt_label: Option<Label>,
                 self.prev_span,
                 "expected iterable, found keyword `in`",
             );
-            err.span_suggestion_short_with_applicability(
+            err.span_suggestion_short(
                 in_span.until(self.prev_span),
                 "remove the duplicated `in`",
                 String::new(),
@@ -3874,7 +3874,7 @@ fn parse_match_expr(&mut self, mut attrs: ThinVec<Attribute>) -> PResult<'a, P<E
                                                None)?;
         if let Err(mut e) = self.expect(&token::OpenDelim(token::Brace)) {
             if self.token == token::Token::Semi {
-                e.span_suggestion_short_with_applicability(
+                e.span_suggestion_short(
                     match_span,
                     "try removing this `match`",
                     String::new(),
@@ -3949,7 +3949,7 @@ fn parse_match_expr(&mut self, mut attrs: ThinVec<Attribute>) -> PResult<'a, P<E
                             //   |      - ^^ self.span
                             //   |      |
                             //   |      parsed until here as `"y" & X`
-                            err.span_suggestion_short_with_applicability(
+                            err.span_suggestion_short(
                                 cm.next_point(arm_start_span),
                                 "missing a comma here to end this `match` arm",
                                 ",".to_owned(),
@@ -4026,7 +4026,7 @@ fn parse_pats(&mut self) -> PResult<'a, Vec<P<Pat>>> {
             if self.token == token::OrOr {
                 let mut err = self.struct_span_err(self.span,
                                                    "unexpected token `||` after pattern");
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     self.span,
                     "use a single `|` to specify multiple patterns",
                     "|".to_owned(),
@@ -4234,7 +4234,7 @@ fn parse_pat_fields(&mut self) -> PResult<'a, (Vec<source_map::Spanned<ast::Fiel
                     // Accept `...` as if it were `..` to avoid further errors
                     let mut err = self.struct_span_err(self.span,
                                                        "expected field pattern, found `...`");
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         self.span,
                         "to omit remaining fields, use one fewer `.`",
                         "..".to_owned(),
@@ -4266,7 +4266,7 @@ fn parse_pat_fields(&mut self) -> PResult<'a, (Vec<source_map::Spanned<ast::Fiel
                 if self.token == token::CloseDelim(token::Brace) {
                     // If the struct looks otherwise well formed, recover and continue.
                     if let Some(sp) = comma_sp {
-                        err.span_suggestion_short_with_applicability(
+                        err.span_suggestion_short(
                             sp,
                             "remove this comma",
                             String::new(),
@@ -4308,7 +4308,7 @@ fn parse_pat_fields(&mut self) -> PResult<'a, (Vec<source_map::Spanned<ast::Fiel
 
         if let Some(mut err) = delayed_err {
             if let Some(etc_span) = etc_span {
-                err.multipart_suggestion_with_applicability(
+                err.multipart_suggestion(
                     "move the `..` to the end of the field list",
                     vec![
                         (etc_span, String::new()),
@@ -4379,7 +4379,7 @@ fn parse_top_level_pat(&mut self) -> PResult<'a, P<Pat>> {
             let mut err = self.struct_span_err(comma_span,
                                                "unexpected `,` in pattern");
             if let Ok(seq_snippet) = self.sess.source_map().span_to_snippet(seq_span) {
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     seq_span,
                     "try adding parentheses",
                     format!("({})", seq_snippet),
@@ -4447,7 +4447,7 @@ fn parse_pat_with_range_pat(
                 let binding_mode = if self.eat_keyword(keywords::Ref) {
                     self.diagnostic()
                         .struct_span_err(mutref_span, "the order of `mut` and `ref` is incorrect")
-                        .span_suggestion_with_applicability(
+                        .span_suggestion(
                             mutref_span,
                             "try switching the order",
                             "ref mut".into(),
@@ -4591,7 +4591,7 @@ fn parse_pat_with_range_pat(
                         pat.span,
                         "the range pattern here has ambiguous interpretation",
                     );
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         pat.span,
                         "add parentheses to clarify the precedence",
                         format!("({})", pprust::pat_to_string(&pat)),
@@ -4667,7 +4667,7 @@ fn parse_local(&mut self, attrs: ThinVec<Attribute>) -> PResult<'a, P<Local>> {
             (Ok(init), Some((_, colon_sp, mut err))) => {  // init parsed, ty error
                 // Could parse the type as if it were the initializer, it is likely there was a
                 // typo in the code: `:` instead of `=`. Add suggestion and emit the error.
-                err.span_suggestion_short_with_applicability(
+                err.span_suggestion_short(
                     colon_sp,
                     "use `=` if you meant to assign",
                     "=".to_string(),
@@ -5170,7 +5170,7 @@ pub fn parse_block(&mut self) -> PResult<'a, P<Block>> {
                 self.token.is_keyword(keywords::In) || self.token == token::Colon;
 
             if self.token.is_ident_named("and") {
-                e.span_suggestion_short_with_applicability(
+                e.span_suggestion_short(
                     self.span,
                     "use `&&` instead of `and` for the boolean operator",
                     "&&".to_string(),
@@ -5178,7 +5178,7 @@ pub fn parse_block(&mut self) -> PResult<'a, P<Block>> {
                 );
             }
             if self.token.is_ident_named("or") {
-                e.span_suggestion_short_with_applicability(
+                e.span_suggestion_short(
                     self.span,
                     "use `||` instead of `or` for the boolean operator",
                     "||".to_string(),
@@ -5213,7 +5213,7 @@ pub fn parse_block(&mut self) -> PResult<'a, P<Block>> {
                         s.print_stmt(&stmt)?;
                         s.bclose_maybe_open(stmt.span, INDENT_UNIT, false)
                     });
-                    e.span_suggestion_with_applicability(
+                    e.span_suggestion(
                         stmt_span,
                         "try placing this code inside a block",
                         sugg,
@@ -5331,10 +5331,10 @@ fn warn_missing_semicolon(&self) {
     fn err_dotdotdot_syntax(&self, span: Span) {
         self.diagnostic().struct_span_err(span, {
             "unexpected token: `...`"
-        }).span_suggestion_with_applicability(
+        }).span_suggestion(
             span, "use `..` for an exclusive range", "..".to_owned(),
             Applicability::MaybeIncorrect
-        ).span_suggestion_with_applicability(
+        ).span_suggestion(
             span, "or `..=` for an inclusive range", "..=".to_owned(),
             Applicability::MaybeIncorrect
         ).emit();
@@ -5534,7 +5534,7 @@ fn parse_trait_item_assoc_ty(&mut self)
                 "lifetime parameters must be declared prior to type parameters",
             );
             if !suggestions.is_empty() {
-                err.multipart_suggestion_with_applicability(
+                err.multipart_suggestion(
                     "move the lifetime parameter prior to the first type parameter",
                     suggestions,
                     Applicability::MachineApplicable,
@@ -5702,7 +5702,7 @@ fn parse_generic_args_with_leaning_angle_bracket_recovery(
                             if plural { "s" } else { "" }
                         ),
                     )
-                    .span_suggestion_with_applicability(
+                    .span_suggestion(
                         span,
                         &format!(
                             "remove extra angle bracket{}",
@@ -5863,7 +5863,7 @@ fn maybe_report_incorrect_generic_argument_order(
             suggestions.extend_from_slice(&type_suggestions);
 
             let plural = bad_lifetime_pos.len() + bad_type_pos.len() > 1;
-            err.multipart_suggestion_with_applicability(
+            err.multipart_suggestion(
                 &format!(
                     "move the parameter{}",
                     if plural { "s" } else { "" },
@@ -5872,7 +5872,7 @@ fn maybe_report_incorrect_generic_argument_order(
                 Applicability::MachineApplicable,
             );
         } else if !lifetime_suggestions.is_empty() {
-            err.multipart_suggestion_with_applicability(
+            err.multipart_suggestion(
                 &format!(
                     "move the lifetime parameter{} prior to the first type parameter",
                     if bad_lifetime_pos.len() > 1 { "s" } else { "" },
@@ -5881,7 +5881,7 @@ fn maybe_report_incorrect_generic_argument_order(
                 Applicability::MachineApplicable,
             );
         } else if !type_suggestions.is_empty() {
-            err.multipart_suggestion_with_applicability(
+            err.multipart_suggestion(
                 &format!(
                     "move the type parameter{} prior to the first associated type binding",
                     if bad_type_pos.len() > 1 { "s" } else { "" },
@@ -6385,7 +6385,7 @@ fn complain_if_pub_macro(&mut self, vis: &VisibilityKind, sp: Span) {
                 let mut err = if is_macro_rules {
                     let mut err = self.diagnostic()
                         .struct_span_err(sp, "can't qualify macro_rules invocation with `pub`");
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         sp,
                         "try exporting the macro",
                         "#[macro_export]".to_owned(),
@@ -6593,7 +6593,7 @@ fn parse_item_impl(&mut self, unsafety: Unsafety, defaultness: Defaultness)
                 // impl Trait for Type
                 if !has_for {
                     self.struct_span_err(missing_for_span, "missing `for` in a trait impl")
-                        .span_suggestion_short_with_applicability(
+                        .span_suggestion_short(
                             missing_for_span,
                             "add `for` here",
                             " for ".to_string(),
@@ -6817,7 +6817,7 @@ fn parse_single_struct_field(&mut self,
                 } else {
                     if seen_comma == false {
                         let sp = self.sess.source_map().next_point(previous_span);
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             sp,
                             "missing comma here",
                             ",".into(),
@@ -6833,7 +6833,7 @@ fn parse_single_struct_field(&mut self,
                                                                 self.this_token_descr()));
                 if self.token.is_ident() {
                     // This is likely another field; emit the diagnostic and keep going
-                    err.span_suggestion_with_applicability(
+                    err.span_suggestion(
                         sp,
                         "try adding a comma",
                         ",".into(),
@@ -6931,7 +6931,7 @@ pub fn parse_visibility(&mut self, can_take_tuple: bool) -> PResult<'a, Visibili
                 self.expect(&token::CloseDelim(token::Paren))?;  // `)`
                 let mut err = struct_span_err!(self.sess.span_diagnostic, sp, E0704, "{}", msg);
                 err.help(suggestion);
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     sp, &help_msg, format!("in {}", path), Applicability::MachineApplicable
                 );
                 err.emit();  // emit diagnostic, but continue with public visibility
@@ -6962,7 +6962,7 @@ fn parse_defaultness(&mut self) -> Defaultness {
     fn maybe_consume_incorrect_semicolon(&mut self, items: &[P<Item>]) -> bool {
         if self.eat(&token::Semi) {
             let mut err = self.struct_span_err(self.prev_span, "expected item, found `;`");
-            err.span_suggestion_short_with_applicability(
+            err.span_suggestion_short(
                 self.prev_span,
                 "remove this semicolon",
                 String::new(),
@@ -7390,7 +7390,7 @@ fn parse_crate_name_with_dashes(&mut self) -> PResult<'a, ast::Ident> {
 
             let mut err = self.struct_span_err(fixed_name_sp, error_msg);
             err.span_label(fixed_name_sp, "dash-separated idents are not valid");
-            err.multipart_suggestion_with_applicability(
+            err.multipart_suggestion(
                 suggestion_msg,
                 replacement,
                 Applicability::MachineApplicable,
@@ -7759,7 +7759,7 @@ fn parse_item_implementation(
                 let mut err = self.diagnostic()
                     .struct_span_err(prev_span, "const globals cannot be mutable");
                 err.span_label(prev_span, "cannot be mutable");
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     const_span,
                     "you might want to declare a static instead",
                     "static".to_owned(),
@@ -7996,7 +7996,7 @@ fn parse_item_implementation(
                                   ident);
                 let mut err = self.diagnostic()
                     .struct_span_err(sp, "missing `struct` for struct definition");
-                err.span_suggestion_short_with_applicability(
+                err.span_suggestion_short(
                     sp, &msg, " struct ".into(), Applicability::MaybeIncorrect // speculative
                 );
                 return Err(err);
@@ -8031,12 +8031,12 @@ fn parse_item_implementation(
                                              kw,
                                              ident,
                                              kw_name);
-                    err.span_suggestion_short_with_applicability(
+                    err.span_suggestion_short(
                         sp, &suggestion, format!(" {} ", kw), Applicability::MachineApplicable
                     );
                 } else {
                     if let Ok(snippet) = self.sess.source_map().span_to_snippet(ident_sp) {
-                        err.span_suggestion_with_applicability(
+                        err.span_suggestion(
                             full_sp,
                             "if you meant to call a macro, try",
                             format!("{}!", snippet),
@@ -8067,7 +8067,7 @@ fn parse_item_implementation(
                 let msg = format!("missing `{}` for {} definition", kw, kw_name);
                 let mut err = self.diagnostic().struct_span_err(sp, &msg);
                 if !ambiguous {
-                    err.span_suggestion_short_with_applicability(
+                    err.span_suggestion_short(
                         sp,
                         &format!("add `{}` here to parse `{}` as a public {}", kw, ident, kw_name),
                         format!(" {} ", kw),
@@ -8094,7 +8094,7 @@ fn parse_item_implementation(
             if self.token.is_keyword(keywords::Const) {
                 self.diagnostic()
                     .struct_span_err(self.span, "extern items cannot be `const`")
-                    .span_suggestion_with_applicability(
+                    .span_suggestion(
                         self.span,
                         "try using a static value",
                         "static".to_owned(),
index 215df4224c5f1ec7516ece1931eabbfea94d120c..4c473fe7612af4acf7bfecd5e4f4e2f9cb736b77 100644 (file)
@@ -763,7 +763,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
                     0 => "{}".to_string(),
                     _ => format!("{}{{}}", "{} ".repeat(args.len())),
                 };
-                err.span_suggestion_with_applicability(
+                err.span_suggestion(
                     fmt_sp.shrink_to_lo(),
                     "you might be missing a string literal to format with",
                     format!("\"{}\", ", sugg_fmt),
@@ -1080,7 +1080,7 @@ macro_rules! check_foreign {
                         ));
                     }
                     if suggestions.len() > 0 {
-                        diag.multipart_suggestion_with_applicability(
+                        diag.multipart_suggestion(
                             "format specifiers use curly braces",
                             suggestions,
                             Applicability::MachineApplicable,