about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorjumbatm <jumbatm@gmail.com>2020-02-02 09:47:58 +1000
committerjumbatm <jumbatm@gmail.com>2020-02-11 19:49:01 +1000
commitd246385122ffd7dd6cc5c490b7e648f58c2ff7fd (patch)
treea5047dc08e4a896995c406d8fbeff527a38e8290 /src/librustc
parent0634a5007306f3951ec28c0b9986452a91eebda8 (diff)
downloadrust-d246385122ffd7dd6cc5c490b7e648f58c2ff7fd.tar.gz
rust-d246385122ffd7dd6cc5c490b7e648f58c2ff7fd.zip
Run RustFmt
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/lint.rs11
-rw-r--r--src/librustc/mir/interpret/error.rs17
-rw-r--r--src/librustc/traits/object_safety.rs12
-rw-r--r--src/librustc/traits/specialize/mod.rs10
-rw-r--r--src/librustc/ty/context.rs4
5 files changed, 31 insertions, 23 deletions
diff --git a/src/librustc/lint.rs b/src/librustc/lint.rs
index a9273fcb8ac..004835b230a 100644
--- a/src/librustc/lint.rs
+++ b/src/librustc/lint.rs
@@ -11,7 +11,6 @@ use rustc_span::hygiene::MacroKind;
 use rustc_span::source_map::{DesugaringKind, ExpnKind, MultiSpan};
 use rustc_span::{Span, Symbol};
 
-
 /// How a lint level was set.
 #[derive(Clone, Copy, PartialEq, Eq, HashStable)]
 pub enum LintSource {
@@ -175,7 +174,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for LintLevelMap {
     }
 }
 
-
 pub struct LintDiagnosticBuilder<'a>(DiagnosticBuilder<'a>);
 
 impl<'a> LintDiagnosticBuilder<'a> {
@@ -186,7 +184,7 @@ impl<'a> LintDiagnosticBuilder<'a> {
     }
 
     /// Create a LintDiagnosticBuilder from some existing DiagnosticBuilder.
-    pub fn new(err: DiagnosticBuilder<'a>) -> LintDiagnosticBuilder<'a>{
+    pub fn new(err: DiagnosticBuilder<'a>) -> LintDiagnosticBuilder<'a> {
         LintDiagnosticBuilder(err)
     }
 }
@@ -207,14 +205,17 @@ pub fn struct_lint_level<'s, 'd>(
         level: Level,
         src: LintSource,
         span: Option<MultiSpan>,
-        decorate: Box<dyn for<'b> FnOnce(LintDiagnosticBuilder<'b>) + 'd>) {
+        decorate: Box<dyn for<'b> FnOnce(LintDiagnosticBuilder<'b>) + 'd>,
+    ) {
         let mut err = match (level, span) {
             (Level::Allow, _) => {
                 return;
             }
             (Level::Warn, Some(span)) => sess.struct_span_warn(span, ""),
             (Level::Warn, None) => sess.struct_warn(""),
-            (Level::Deny, Some(span)) | (Level::Forbid, Some(span)) => sess.struct_span_err(span, ""),
+            (Level::Deny, Some(span)) | (Level::Forbid, Some(span)) => {
+                sess.struct_span_err(span, "")
+            }
             (Level::Deny, None) | (Level::Forbid, None) => sess.struct_err(""),
         };
 
diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs
index bb84458cf7b..df3971a5ac3 100644
--- a/src/librustc/mir/interpret/error.rs
+++ b/src/librustc/mir/interpret/error.rs
@@ -120,19 +120,18 @@ impl<'tcx> ConstEvalErr<'tcx> {
                     }
                 }
                 lint.emit();
-            }
-        , Some(lint_root)) {
-            Ok(_) => {
-                ErrorHandled::Reported
-            }
+            },
+            Some(lint_root),
+        ) {
+            Ok(_) => ErrorHandled::Reported,
             Err(err) => err,
         }
     }
 
-   /// Sets the message passed in via `message`, then adds the span labels for you, before applying
-   /// further modifications in `emit`. It's up to you to call emit(), stash(..), etc. within the
-   /// `emit` method. If you don't need to do any additional processing, just use
-   /// struct_generic.
+    /// Sets the message passed in via `message`, then adds the span labels for you, before applying
+    /// further modifications in `emit`. It's up to you to call emit(), stash(..), etc. within the
+    /// `emit` method. If you don't need to do any additional processing, just use
+    /// struct_generic.
     fn struct_generic(
         &self,
         tcx: TyCtxtAt<'tcx>,
diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs
index 0e6347897d2..4c5cd866b4a 100644
--- a/src/librustc/traits/object_safety.rs
+++ b/src/librustc/traits/object_safety.rs
@@ -238,7 +238,10 @@ fn object_safety_violations_for_trait(
                         ));
                         let node = tcx.hir().get_if_local(trait_def_id);
                         let msg = if let Some(hir::Node::Item(item)) = node {
-                            err.span_label(item.ident.span, "this trait cannot be made into an object...");
+                            err.span_label(
+                                item.ident.span,
+                                "this trait cannot be made into an object...",
+                            );
                             format!("...because {}", violation.error_msg())
                         } else {
                             format!(
@@ -252,7 +255,12 @@ fn object_safety_violations_for_trait(
                                 err.help(&note);
                             }
                             (Some(_), Some((note, Some((sugg, span))))) => {
-                                err.span_suggestion(span, &note, sugg, Applicability::MachineApplicable);
+                                err.span_suggestion(
+                                    span,
+                                    &note,
+                                    sugg,
+                                    Applicability::MachineApplicable,
+                                );
                             }
                             // Only provide the help if its a local trait, otherwise it's not actionable.
                             _ => {}
diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs
index 33a78ae896b..7c93a35158b 100644
--- a/src/librustc/traits/specialize/mod.rs
+++ b/src/librustc/traits/specialize/mod.rs
@@ -16,13 +16,13 @@ use crate::traits::select::IntercrateAmbiguityCause;
 use crate::traits::{self, coherence, FutureCompatOverlapErrorKind, ObligationCause, TraitEngine};
 use crate::ty::subst::{InternalSubsts, Subst, SubstsRef};
 use crate::ty::{self, TyCtxt, TypeFoldable};
+use rustc::lint::LintDiagnosticBuilder;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_errors::struct_span_err;
 use rustc_hir::def_id::DefId;
 use rustc_session::lint::builtin::COHERENCE_LEAK_CHECK;
 use rustc_session::lint::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS;
 use rustc_span::DUMMY_SP;
-use rustc::lint::LintDiagnosticBuilder;
 
 use super::util::impl_trait_ref_and_oblig;
 use super::{FulfillmentContext, SelectionContext};
@@ -357,9 +357,10 @@ pub(super) fn specialization_graph_provider(
                         }
                         Err(cname) => {
                             let msg = match to_pretty_impl_header(tcx, overlap.with_impl) {
-                                Some(s) => {
-                                    format!("conflicting implementation in crate `{}`:\n- {}", cname, s)
-                                }
+                                Some(s) => format!(
+                                    "conflicting implementation in crate `{}`:\n- {}",
+                                    cname, s
+                                ),
                                 None => format!("conflicting implementation in crate `{}`", cname),
                             };
                             err.note(&msg);
@@ -396,7 +397,6 @@ pub(super) fn specialization_graph_provider(
                         )
                     }
                 };
-
             }
         } else {
             let parent = tcx.impl_parent(impl_def_id).unwrap_or(trait_id);
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs
index a885f9e9600..f2ad01b3d59 100644
--- a/src/librustc/ty/context.rs
+++ b/src/librustc/ty/context.rs
@@ -41,8 +41,8 @@ use crate::ty::{ExistentialPredicate, InferTy, ParamTy, PolyFnSig, Predicate, Pr
 use crate::ty::{InferConst, ParamConst};
 use crate::ty::{List, TyKind, TyS};
 use crate::util::common::ErrorReported;
-use rustc_attr as attr;
 use rustc::lint::LintDiagnosticBuilder;
+use rustc_attr as attr;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_data_structures::profiling::SelfProfilerRef;
 use rustc_data_structures::sharded::{IntoPointer, ShardedHashMap};
@@ -2594,7 +2594,7 @@ impl<'tcx> TyCtxt<'tcx> {
         lint: &'static Lint,
         hir_id: HirId,
         span: impl Into<MultiSpan>,
-        decorate: impl for<'a> FnOnce(LintDiagnosticBuilder<'a>)
+        decorate: impl for<'a> FnOnce(LintDiagnosticBuilder<'a>),
     ) {
         let (level, src) = self.lint_level_at_node(lint, hir_id);
         struct_lint_level(self.sess, lint, level, src, Some(span.into()), decorate);