about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorAndy Russell <arussell123@gmail.com>2019-01-25 16:03:27 -0500
committerAndy Russell <arussell123@gmail.com>2019-01-26 23:07:55 -0500
commit0897ffc28f68fab862e970599c95bb65b280b48b (patch)
tree7a1b107f558b9fc90815eadae7b004129b509f8f /src/librustc
parent8eaa84c79f5491735dc616d8591318e954e57a68 (diff)
downloadrust-0897ffc28f68fab862e970599c95bb65b280b48b.tar.gz
rust-0897ffc28f68fab862e970599c95bb65b280b48b.zip
remove `_with_applicability` from suggestion fns
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/hir/lowering.rs2
-rw-r--r--src/librustc/infer/error_reporting/mod.rs8
-rw-r--r--src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs2
-rw-r--r--src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs2
-rw-r--r--src/librustc/lint/builtin.rs13
-rw-r--r--src/librustc/lint/levels.rs6
-rw-r--r--src/librustc/middle/liveness.rs14
-rw-r--r--src/librustc/middle/resolve_lifetime.rs8
-rw-r--r--src/librustc/session/mod.rs2
-rw-r--r--src/librustc/traits/error_reporting.rs24
-rw-r--r--src/librustc/ty/error.rs2
11 files changed, 41 insertions, 42 deletions
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 905a3ceed81..51dbad92225 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -1829,7 +1829,7 @@ impl<'a> LoweringContext<'a> {
                         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]),
diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs
index 35f6e6aa610..66e4cd49c80 100644
--- a/src/librustc/infer/error_reporting/mod.rs
+++ b/src/librustc/infer/error_reporting/mod.rs
@@ -499,7 +499,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                 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 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                 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 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                                 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 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                     let tail = if has_lifetimes { " + " } else { "" };
                     format!("{}: {}{}", bound_kind, sub, tail)
                 };
-                err.span_suggestion_short_with_applicability(
+                err.span_suggestion_short(
                     sp,
                     &consider,
                     suggestion,
diff --git a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs
index daab0a8e962..918a46aacd0 100644
--- a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs
+++ b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs
@@ -102,7 +102,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
             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(),
diff --git a/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs b/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs
index 9fc3bb05cda..7501e2f2108 100644
--- a/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs
+++ b/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs
@@ -53,7 +53,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
                         _ => "'_".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 \
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index 2b5fcafc905..35a03823595 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -473,7 +473,7 @@ impl BuiltinLintDiagnostics {
                     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 @@ impl BuiltinLintDiagnostics {
                     }
                     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 @@ impl BuiltinLintDiagnostics {
                         (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 @@ impl BuiltinLintDiagnostics {
                 );
             }
             BuiltinLintDiagnostics::UnknownCrateTypes(span, note, sugg) => {
-                db.span_suggestion_with_applicability(
-                    span,
-                    &note,
-                    sugg,
-                    Applicability::MaybeIncorrect
-                );
+                db.span_suggestion(span, &note, sugg, Applicability::MaybeIncorrect);
             }
         }
     }
diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs
index 8b45a5a1504..61691576943 100644
--- a/src/librustc/lint/levels.rs
+++ b/src/librustc/lint/levels.rs
@@ -324,7 +324,7 @@ impl<'a> LintLevelsBuilder<'a> {
                                     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 @@ impl<'a> LintLevelsBuilder<'a> {
                                                               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 @@ impl<'a> LintLevelsBuilder<'a> {
                                                 &msg);
 
                         if let Some(suggestion) = suggestion {
-                            db.span_suggestion_with_applicability(
+                            db.span_suggestion(
                                 li.span,
                                 "did you mean",
                                 suggestion.to_string(),
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index 220bec735a4..cc0dd71738f 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -1600,12 +1600,16 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
                     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,
                         );
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs
index 2d3653464d5..34db30a1706 100644
--- a/src/librustc/middle/resolve_lifetime.rs
+++ b/src/librustc/middle/resolve_lifetime.rs
@@ -1526,14 +1526,14 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
             // 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 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
                             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 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
                 } else {
                     (format!("{} + 'static", snippet), Applicability::MaybeIncorrect)
                 };
-                db.span_suggestion_with_applicability(span, msg, sugg, applicability);
+                db.span_suggestion(span, msg, sugg, applicability);
                 false
             }
             Err(_) => {
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs
index cf00bf330de..875021e20d4 100644
--- a/src/librustc/session/mod.rs
+++ b/src/librustc/session/mod.rs
@@ -435,7 +435,7 @@ impl Session {
                 }
                 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,
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index 1c92e2da588..5debb119029 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -904,7 +904,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                 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 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                         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 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
             // 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 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                         .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 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
                             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,
                     );
                 }
             }
diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs
index 834b541d4c0..f444013e2a3 100644
--- a/src/librustc/ty/error.rs
+++ b/src/librustc/ty/error.rs
@@ -237,7 +237,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
                 {
                     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),