Skip to content

Commit 62f7804

Browse files
committed
Run RustFmt
1 parent a97e8bb commit 62f7804

File tree

36 files changed

+477
-514
lines changed

36 files changed

+477
-514
lines changed

src/librustc/lint.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use rustc_span::hygiene::MacroKind;
1111
use rustc_span::source_map::{DesugaringKind, ExpnKind, MultiSpan};
1212
use rustc_span::{Span, Symbol};
1313

14-
1514
/// How a lint level was set.
1615
#[derive(Clone, Copy, PartialEq, Eq, HashStable)]
1716
pub enum LintSource {
@@ -175,7 +174,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for LintLevelMap {
175174
}
176175
}
177176

178-
179177
pub struct LintDiagnosticBuilder<'a>(DiagnosticBuilder<'a>);
180178

181179
impl<'a> LintDiagnosticBuilder<'a> {
@@ -186,7 +184,7 @@ impl<'a> LintDiagnosticBuilder<'a> {
186184
}
187185

188186
/// Create a LintDiagnosticBuilder from some existing DiagnosticBuilder.
189-
pub fn new(err: DiagnosticBuilder<'a>) -> LintDiagnosticBuilder<'a>{
187+
pub fn new(err: DiagnosticBuilder<'a>) -> LintDiagnosticBuilder<'a> {
190188
LintDiagnosticBuilder(err)
191189
}
192190
}
@@ -207,14 +205,17 @@ pub fn struct_lint_level<'s, 'd>(
207205
level: Level,
208206
src: LintSource,
209207
span: Option<MultiSpan>,
210-
decorate: Box<dyn for<'b> FnOnce(LintDiagnosticBuilder<'b>) + 'd>) {
208+
decorate: Box<dyn for<'b> FnOnce(LintDiagnosticBuilder<'b>) + 'd>,
209+
) {
211210
let mut err = match (level, span) {
212211
(Level::Allow, _) => {
213212
return;
214213
}
215214
(Level::Warn, Some(span)) => sess.struct_span_warn(span, ""),
216215
(Level::Warn, None) => sess.struct_warn(""),
217-
(Level::Deny, Some(span)) | (Level::Forbid, Some(span)) => sess.struct_span_err(span, ""),
216+
(Level::Deny, Some(span)) | (Level::Forbid, Some(span)) => {
217+
sess.struct_span_err(span, "")
218+
}
218219
(Level::Deny, None) | (Level::Forbid, None) => sess.struct_err(""),
219220
};
220221

src/librustc/mir/interpret/error.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,18 @@ impl<'tcx> ConstEvalErr<'tcx> {
120120
}
121121
}
122122
lint.emit();
123-
}
124-
, Some(lint_root)) {
125-
Ok(_) => {
126-
ErrorHandled::Reported
127-
}
123+
},
124+
Some(lint_root),
125+
) {
126+
Ok(_) => ErrorHandled::Reported,
128127
Err(err) => err,
129128
}
130129
}
131130

132-
/// Sets the message passed in via `message`, then adds the span labels for you, before applying
133-
/// further modifications in `emit`. It's up to you to call emit(), stash(..), etc. within the
134-
/// `emit` method. If you don't need to do any additional processing, just use
135-
/// struct_generic.
131+
/// Sets the message passed in via `message`, then adds the span labels for you, before applying
132+
/// further modifications in `emit`. It's up to you to call emit(), stash(..), etc. within the
133+
/// `emit` method. If you don't need to do any additional processing, just use
134+
/// struct_generic.
136135
fn struct_generic(
137136
&self,
138137
tcx: TyCtxtAt<'tcx>,

src/librustc/traits/object_safety.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ fn object_safety_violations_for_trait(
184184
hir::CRATE_HIR_ID,
185185
*span,
186186
|lint| {
187-
lint.build(
188-
&format!(
187+
lint.build(&format!(
189188
"the trait `{}` cannot be made into an object",
190189
tcx.def_path_str(trait_def_id)
191190
))

src/librustc/traits/specialize/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ use crate::traits::select::IntercrateAmbiguityCause;
1616
use crate::traits::{self, coherence, FutureCompatOverlapErrorKind, ObligationCause, TraitEngine};
1717
use crate::ty::subst::{InternalSubsts, Subst, SubstsRef};
1818
use crate::ty::{self, TyCtxt, TypeFoldable};
19+
use rustc::lint::LintDiagnosticBuilder;
1920
use rustc_data_structures::fx::FxHashSet;
2021
use rustc_errors::struct_span_err;
2122
use rustc_hir::def_id::DefId;
2223
use rustc_session::lint::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS;
2324
use rustc_span::DUMMY_SP;
24-
use rustc::lint::LintDiagnosticBuilder;
2525

2626
use super::util::impl_trait_ref_and_oblig;
2727
use super::{FulfillmentContext, SelectionContext};
@@ -356,9 +356,10 @@ pub(super) fn specialization_graph_provider(
356356
}
357357
Err(cname) => {
358358
let msg = match to_pretty_impl_header(tcx, overlap.with_impl) {
359-
Some(s) => {
360-
format!("conflicting implementation in crate `{}`:\n- {}", cname, s)
361-
}
359+
Some(s) => format!(
360+
"conflicting implementation in crate `{}`:\n- {}",
361+
cname, s
362+
),
362363
None => format!("conflicting implementation in crate `{}`", cname),
363364
};
364365
err.note(&msg);
@@ -397,7 +398,6 @@ pub(super) fn specialization_graph_provider(
397398
)
398399
}
399400
};
400-
401401
}
402402
} else {
403403
let parent = tcx.impl_parent(impl_def_id).unwrap_or(trait_id);

src/librustc/ty/context.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ use crate::ty::{ExistentialPredicate, InferTy, ParamTy, PolyFnSig, Predicate, Pr
4141
use crate::ty::{InferConst, ParamConst};
4242
use crate::ty::{List, TyKind, TyS};
4343
use crate::util::common::ErrorReported;
44-
use rustc_attr as attr;
4544
use rustc::lint::LintDiagnosticBuilder;
45+
use rustc_attr as attr;
4646
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
4747
use rustc_data_structures::profiling::SelfProfilerRef;
4848
use rustc_data_structures::sharded::{IntoPointer, ShardedHashMap};
@@ -2593,7 +2593,7 @@ impl<'tcx> TyCtxt<'tcx> {
25932593
lint: &'static Lint,
25942594
hir_id: HirId,
25952595
span: impl Into<MultiSpan>,
2596-
decorate: impl for<'a> FnOnce(LintDiagnosticBuilder<'a>)
2596+
decorate: impl for<'a> FnOnce(LintDiagnosticBuilder<'a>),
25972597
) {
25982598
let (level, src) = self.lint_level_at_node(lint, hir_id);
25992599
struct_lint_level(self.sess, lint, level, src, Some(span.into()), decorate);

src/librustc_attr/builtin.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ fn handle_errors(sess: &ParseSess, span: Span, error: AttrError) {
3737
.span_label(span, format!("expected one of {}", expected.join(", ")))
3838
.emit();
3939
}
40-
AttrError::MissingSince => { struct_span_err!(diag, span, E0542, "missing 'since'").emit(); },
40+
AttrError::MissingSince => {
41+
struct_span_err!(diag, span, E0542, "missing 'since'").emit();
42+
}
4143
AttrError::MissingFeature => {
4244
struct_span_err!(diag, span, E0546, "missing 'feature'").emit();
4345
}

src/librustc_errors/diagnostic_builder.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ impl<'a> DiagnosticBuilder<'a> {
106106
///
107107
/// See `emit` and `delay_as_bug` for details.
108108
pub fn emit_unless(&mut self, delay: bool) {
109-
if delay { self.delay_as_bug(); } else { self.emit(); }
109+
if delay {
110+
self.delay_as_bug();
111+
} else {
112+
self.emit();
113+
}
110114
}
111115

112116
/// Stashes diagnostic for possible later improvement in a different,

src/librustc_expand/base.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,11 @@ pub fn expr_to_string(
11131113
err_msg: &str,
11141114
) -> Option<(Symbol, ast::StrStyle)> {
11151115
expr_to_spanned_string(cx, expr, err_msg)
1116-
.map_err(|err| err.map(|mut err| { err.emit(); }))
1116+
.map_err(|err| {
1117+
err.map(|mut err| {
1118+
err.emit();
1119+
})
1120+
})
11171121
.ok()
11181122
.map(|(symbol, style, _)| (symbol, style))
11191123
}

0 commit comments

Comments
 (0)