提交 3a9c3f92 编写于 作者: E Esteban Küber

Format and fix rebase

上级 fb528836
......@@ -2,12 +2,13 @@
//! The main routine here is `ast_ty_to_ty()`; each use is parameterized by an
//! instance of `AstConv`.
use crate::collect::PlaceholderHirTyCollector;
use crate::hir::def::{CtorOf, DefKind, Res};
use crate::hir::def_id::DefId;
use crate::hir::intravisit::Visitor;
use crate::hir::print;
use crate::hir::ptr::P;
use crate::hir::{self, ExprKind, GenericArg, GenericArgs, HirVec};
use crate::hir::intravisit::Visitor;
use crate::lint;
use crate::middle::lang_items::SizedTraitLangItem;
use crate::middle::resolve_lifetime as rl;
......@@ -16,7 +17,6 @@
use crate::util::common::ErrorReported;
use crate::util::nodemap::FxHashMap;
use errors::{Applicability, DiagnosticId};
use crate::collect::PlaceholderHirTyCollector;
use rustc::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS;
use rustc::traits;
use rustc::ty::subst::{self, InternalSubsts, Subst, SubstsRef};
......@@ -2786,11 +2786,7 @@ pub fn ty_of_fn(
hir::Return(ref output) => {
let mut visitor = PlaceholderHirTyCollector::new();
visitor.visit_ty(output);
let is_infer = if let hir::TyKind::Infer = output.kind {
true
} else {
false
};
let is_infer = if let hir::TyKind::Infer = output.kind { true } else { false };
if (is_infer || !visitor.0.is_empty()) && !self.allow_ty_infer() {
output_placeholder_types.extend(visitor.0);
tcx.types.err
......
......@@ -135,10 +135,13 @@ struct CollectItemTypesVisitor<'tcx> {
) {
if !placeholder_types.is_empty() {
let possible_names = ["T", "K", "L", "A", "B", "C"];
let used_names = generics.iter().filter_map(|p| match p.name {
hir::ParamName::Plain(ident) => Some(ident.name),
_ => None,
}).collect::<Vec<_>>();
let used_names = generics
.iter()
.filter_map(|p| match p.name {
hir::ParamName::Plain(ident) => Some(ident.name),
_ => None,
})
.collect::<Vec<_>>();
let mut type_name = "ParamName";
for name in &possible_names {
......@@ -147,10 +150,9 @@ struct CollectItemTypesVisitor<'tcx> {
break;
}
}
let mut sugg: Vec<_> = placeholder_types.iter()
.map(|sp| (*sp, type_name.to_string()))
.collect();
let mut sugg: Vec<_> =
placeholder_types.iter().map(|sp| (*sp, type_name.to_string())).collect();
if generics.is_empty() {
sugg.push((ident_span.shrink_to_hi(), format!("<{}>", type_name)));
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册