Skip to content

Commit

Permalink
rustc/middle: whitespace & formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Oct 6, 2018
1 parent 96736f2 commit 786b86e
Show file tree
Hide file tree
Showing 14 changed files with 534 additions and 572 deletions.
6 changes: 3 additions & 3 deletions src/librustc/middle/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
}

fn visit_variant_data(&mut self, def: &'tcx hir::VariantData, _: ast::Name,
_: &hir::Generics, _: ast::NodeId, _: syntax_pos::Span) {
_: &hir::Generics, _: ast::NodeId, _: syntax_pos::Span) {
let has_repr_c = self.repr_has_repr_c;
let inherited_pub_visibility = self.inherited_pub_visibility;
let live_fields = def.fields().iter().filter(|f| {
Expand Down Expand Up @@ -492,8 +492,8 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> {
ctor_id: Option<ast::NodeId>)
-> bool {
if self.live_symbols.contains(&id)
|| ctor_id.map_or(false,
|ctor| self.live_symbols.contains(&ctor)) {
|| ctor_id.map_or(false, |ctor| self.live_symbols.contains(&ctor))
{
return true;
}
// If it's a type whose items are live, then it's live, too.
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/dependency_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
let src = tcx.used_crate_source(cnum);
if src.rlib.is_some() { continue }
sess.err(&format!("crate `{}` required to be available in rlib format, \
but was not found in this form",
but was not found in this form",
tcx.crate_name(cnum)));
}
return Vec::new();
Expand Down Expand Up @@ -247,7 +247,7 @@ fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
_ => "dylib",
};
sess.err(&format!("crate `{}` required to be available in {} format, \
but was not found in this form",
but was not found in this form",
tcx.crate_name(cnum), kind));
}
}
Expand Down
10 changes: 3 additions & 7 deletions src/librustc/middle/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.


use hir::map as hir_map;
use hir::def_id::{CRATE_DEF_INDEX};
use session::{config, Session};
Expand Down Expand Up @@ -131,7 +130,7 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
ctxt.attr_main_fn = Some((item.id, item.span));
} else {
struct_span_err!(ctxt.session, item.span, E0137,
"multiple functions with a #[main] attribute")
"multiple functions with a #[main] attribute")
.span_label(item.span, "additional #[main] function")
.span_label(ctxt.attr_main_fn.unwrap().1, "first #[main] function")
.emit();
Expand All @@ -141,11 +140,8 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
if ctxt.start_fn.is_none() {
ctxt.start_fn = Some((item.id, item.span));
} else {
struct_span_err!(
ctxt.session, item.span, E0138,
"multiple 'start' functions")
.span_label(ctxt.start_fn.unwrap().1,
"previous `start` function here")
struct_span_err!(ctxt.session, item.span, E0138, "multiple 'start' functions")
.span_label(ctxt.start_fn.unwrap().1, "previous `start` function here")
.span_label(item.span, "multiple `start` functions")
.emit();
}
Expand Down
19 changes: 10 additions & 9 deletions src/librustc/middle/expr_use_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
region::Scope {
id: body.value.hir_id.local_id,
data: region::ScopeData::Node
}));
}));
let arg_cmt = Rc::new(self.mc.cat_rvalue(
arg.hir_id,
arg.pat.span,
Expand Down Expand Up @@ -402,20 +402,20 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
self.walk_expr(&subexpr)
}

hir::ExprKind::Unary(hir::UnDeref, ref base) => { // *base
hir::ExprKind::Unary(hir::UnDeref, ref base) => { // *base
self.select_from_expr(&base);
}

hir::ExprKind::Field(ref base, _) => { // base.f
hir::ExprKind::Field(ref base, _) => { // base.f
self.select_from_expr(&base);
}

hir::ExprKind::Index(ref lhs, ref rhs) => { // lhs[rhs]
hir::ExprKind::Index(ref lhs, ref rhs) => { // lhs[rhs]
self.select_from_expr(&lhs);
self.consume_expr(&rhs);
}

hir::ExprKind::Call(ref callee, ref args) => { // callee(args)
hir::ExprKind::Call(ref callee, ref args) => { // callee(args)
self.walk_callee(expr, &callee);
self.consume_exprs(args);
}
Expand Down Expand Up @@ -824,12 +824,13 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
cmt_discr: mc::cmt<'tcx>,
pat: &hir::Pat,
mode: &mut TrackMatchMode) {
debug!("determine_pat_move_mode cmt_discr={:?} pat={:?}", cmt_discr,
pat);
debug!("determine_pat_move_mode cmt_discr={:?} pat={:?}", cmt_discr, pat);

return_if_err!(self.mc.cat_pattern(cmt_discr, pat, |cmt_pat, pat| {
if let PatKind::Binding(..) = pat.node {
let bm = *self.mc.tables.pat_binding_modes().get(pat.hir_id)
.expect("missing binding mode");
let bm = *self.mc.tables.pat_binding_modes()
.get(pat.hir_id)
.expect("missing binding mode");
match bm {
ty::BindByReference(..) =>
mode.lub(BorrowingMatch),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/intrinsicck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl<'a, 'tcx> ExprVisitor<'a, 'tcx> {
};

struct_span_err!(self.tcx.sess, span, E0512,
"transmute called with types of different sizes")
"transmute called with types of different sizes")
.note(&format!("source type: {} ({})", from, skeleton_string(from, sk_from)))
.note(&format!("target type: {} ({})", to, skeleton_string(to, sk_to)))
.emit();
Expand Down
4 changes: 1 addition & 3 deletions src/librustc/middle/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ macro_rules! language_item_table {
$( $variant:ident, $name:expr, $method:ident; )*
) => {


enum_from_u32! {
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
pub enum LangItem {
Expand Down Expand Up @@ -161,8 +160,7 @@ impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
name)),
};
if let Some(span) = self.tcx.hir.span_if_local(original_def_id) {
span_note!(&mut err, span,
"first defined here.");
span_note!(&mut err, span, "first defined here.");
} else {
err.note(&format!("first defined in crate `{}`.",
self.tcx.crate_name(original_def_id.krate)));
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/lib_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ impl<'a, 'tcx> LibFeatureCollector<'a, 'tcx> {
let msg = format!(
"feature `{}` is declared {}, but was previously declared {}",
feature,
if since.is_some() { "stable"} else { "unstable" },
if since.is_none() { "stable"} else { "unstable" },
if since.is_some() { "stable" } else { "unstable" },
if since.is_none() { "stable" } else { "unstable" },
);
self.tcx.sess.struct_span_err_with_code(span, &msg,
DiagnosticId::Error("E0711".into())).emit();
Expand Down
Loading

0 comments on commit 786b86e

Please sign in to comment.