Skip to content

Commit 3a9c3f9

Browse files
committed
Format and fix rebase
1 parent fb52883 commit 3a9c3f9

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

src/librustc_typeck/astconv.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
//! The main routine here is `ast_ty_to_ty()`; each use is parameterized by an
33
//! instance of `AstConv`.
44
5+
use crate::collect::PlaceholderHirTyCollector;
56
use crate::hir::def::{CtorOf, DefKind, Res};
67
use crate::hir::def_id::DefId;
8+
use crate::hir::intravisit::Visitor;
79
use crate::hir::print;
810
use crate::hir::ptr::P;
911
use crate::hir::{self, ExprKind, GenericArg, GenericArgs, HirVec};
10-
use crate::hir::intravisit::Visitor;
1112
use crate::lint;
1213
use crate::middle::lang_items::SizedTraitLangItem;
1314
use crate::middle::resolve_lifetime as rl;
@@ -16,7 +17,6 @@ use crate::require_c_abi_if_c_variadic;
1617
use crate::util::common::ErrorReported;
1718
use crate::util::nodemap::FxHashMap;
1819
use errors::{Applicability, DiagnosticId};
19-
use crate::collect::PlaceholderHirTyCollector;
2020
use rustc::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS;
2121
use rustc::traits;
2222
use rustc::ty::subst::{self, InternalSubsts, Subst, SubstsRef};
@@ -2786,11 +2786,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
27862786
hir::Return(ref output) => {
27872787
let mut visitor = PlaceholderHirTyCollector::new();
27882788
visitor.visit_ty(output);
2789-
let is_infer = if let hir::TyKind::Infer = output.kind {
2790-
true
2791-
} else {
2792-
false
2793-
};
2789+
let is_infer = if let hir::TyKind::Infer = output.kind { true } else { false };
27942790
if (is_infer || !visitor.0.is_empty()) && !self.allow_ty_infer() {
27952791
output_placeholder_types.extend(visitor.0);
27962792
tcx.types.err

src/librustc_typeck/collect.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,13 @@ crate fn placeholder_type_error(
135135
) {
136136
if !placeholder_types.is_empty() {
137137
let possible_names = ["T", "K", "L", "A", "B", "C"];
138-
let used_names = generics.iter().filter_map(|p| match p.name {
139-
hir::ParamName::Plain(ident) => Some(ident.name),
140-
_ => None,
141-
}).collect::<Vec<_>>();
138+
let used_names = generics
139+
.iter()
140+
.filter_map(|p| match p.name {
141+
hir::ParamName::Plain(ident) => Some(ident.name),
142+
_ => None,
143+
})
144+
.collect::<Vec<_>>();
142145

143146
let mut type_name = "ParamName";
144147
for name in &possible_names {
@@ -147,10 +150,9 @@ crate fn placeholder_type_error(
147150
break;
148151
}
149152
}
150-
151-
let mut sugg: Vec<_> = placeholder_types.iter()
152-
.map(|sp| (*sp, type_name.to_string()))
153-
.collect();
153+
154+
let mut sugg: Vec<_> =
155+
placeholder_types.iter().map(|sp| (*sp, type_name.to_string())).collect();
154156
if generics.is_empty() {
155157
sugg.push((ident_span.shrink_to_hi(), format!("<{}>", type_name)));
156158
} else {

0 commit comments

Comments
 (0)