Remove unused cache argument
This commit is contained in:
parent
076fa63424
commit
3c8e13aff1
1 changed files with 9 additions and 12 deletions
|
@ -173,9 +173,9 @@ crate fn get_index_search_type<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
) -> Option<IndexItemFunctionType> {
|
) -> Option<IndexItemFunctionType> {
|
||||||
let (all_types, ret_types) = match *item.kind {
|
let (all_types, ret_types) = match *item.kind {
|
||||||
clean::FunctionItem(ref f) => get_all_types(&f.generics, &f.decl, tcx, &cache),
|
clean::FunctionItem(ref f) => get_all_types(&f.generics, &f.decl, tcx),
|
||||||
clean::MethodItem(ref m, _) => get_all_types(&m.generics, &m.decl, tcx, &cache),
|
clean::MethodItem(ref m, _) => get_all_types(&m.generics, &m.decl, tcx),
|
||||||
clean::TyMethodItem(ref m) => get_all_types(&m.generics, &m.decl, tcx, &cache),
|
clean::TyMethodItem(ref m) => get_all_types(&m.generics, &m.decl, tcx),
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -257,7 +257,6 @@ crate fn get_real_types<'tcx>(
|
||||||
arg: &Type,
|
arg: &Type,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
recurse: i32,
|
recurse: i32,
|
||||||
cache: &Cache,
|
|
||||||
res: &mut FxHashSet<(Type, TypeKind)>,
|
res: &mut FxHashSet<(Type, TypeKind)>,
|
||||||
) -> usize {
|
) -> usize {
|
||||||
fn insert(res: &mut FxHashSet<(Type, TypeKind)>, tcx: TyCtxt<'_>, ty: Type) -> usize {
|
fn insert(res: &mut FxHashSet<(Type, TypeKind)>, tcx: TyCtxt<'_>, ty: Type) -> usize {
|
||||||
|
@ -279,8 +278,7 @@ crate fn get_real_types<'tcx>(
|
||||||
}
|
}
|
||||||
let mut nb_added = 0;
|
let mut nb_added = 0;
|
||||||
|
|
||||||
if arg.is_full_generic() {
|
if let &Type::Generic(arg_s) = arg {
|
||||||
let arg_s = Symbol::intern(&arg.print(cache).to_string());
|
|
||||||
if let Some(where_pred) = generics.where_predicates.iter().find(|g| match g {
|
if let Some(where_pred) = generics.where_predicates.iter().find(|g| match g {
|
||||||
WherePredicate::BoundPredicate { ty, .. } => ty.def_id() == arg.def_id(),
|
WherePredicate::BoundPredicate { ty, .. } => ty.def_id() == arg.def_id(),
|
||||||
_ => false,
|
_ => false,
|
||||||
|
@ -293,7 +291,7 @@ crate fn get_real_types<'tcx>(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if let Some(ty) = x.get_type() {
|
if let Some(ty) = x.get_type() {
|
||||||
let adds = get_real_types(generics, &ty, tcx, recurse + 1, cache, res);
|
let adds = get_real_types(generics, &ty, tcx, recurse + 1, res);
|
||||||
nb_added += adds;
|
nb_added += adds;
|
||||||
if adds == 0 && !ty.is_full_generic() {
|
if adds == 0 && !ty.is_full_generic() {
|
||||||
nb_added += insert(res, tcx, ty);
|
nb_added += insert(res, tcx, ty);
|
||||||
|
@ -306,7 +304,7 @@ crate fn get_real_types<'tcx>(
|
||||||
if let Some(bound) = generics.params.iter().find(|g| g.is_type() && g.name == arg_s) {
|
if let Some(bound) = generics.params.iter().find(|g| g.is_type() && g.name == arg_s) {
|
||||||
for bound in bound.get_bounds().unwrap_or(&[]) {
|
for bound in bound.get_bounds().unwrap_or(&[]) {
|
||||||
if let Some(ty) = bound.get_trait_type() {
|
if let Some(ty) = bound.get_trait_type() {
|
||||||
let adds = get_real_types(generics, &ty, tcx, recurse + 1, cache, res);
|
let adds = get_real_types(generics, &ty, tcx, recurse + 1, res);
|
||||||
nb_added += adds;
|
nb_added += adds;
|
||||||
if adds == 0 && !ty.is_full_generic() {
|
if adds == 0 && !ty.is_full_generic() {
|
||||||
nb_added += insert(res, tcx, ty);
|
nb_added += insert(res, tcx, ty);
|
||||||
|
@ -319,7 +317,7 @@ crate fn get_real_types<'tcx>(
|
||||||
if let Some(gens) = arg.generics() {
|
if let Some(gens) = arg.generics() {
|
||||||
for gen in gens.iter() {
|
for gen in gens.iter() {
|
||||||
if gen.is_full_generic() {
|
if gen.is_full_generic() {
|
||||||
nb_added += get_real_types(generics, gen, tcx, recurse + 1, cache, res);
|
nb_added += get_real_types(generics, gen, tcx, recurse + 1, res);
|
||||||
} else {
|
} else {
|
||||||
nb_added += insert(res, tcx, (*gen).clone());
|
nb_added += insert(res, tcx, (*gen).clone());
|
||||||
}
|
}
|
||||||
|
@ -337,7 +335,6 @@ crate fn get_all_types<'tcx>(
|
||||||
generics: &Generics,
|
generics: &Generics,
|
||||||
decl: &FnDecl,
|
decl: &FnDecl,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
cache: &Cache,
|
|
||||||
) -> (Vec<(Type, TypeKind)>, Vec<(Type, TypeKind)>) {
|
) -> (Vec<(Type, TypeKind)>, Vec<(Type, TypeKind)>) {
|
||||||
let mut all_types = FxHashSet::default();
|
let mut all_types = FxHashSet::default();
|
||||||
for arg in decl.inputs.values.iter() {
|
for arg in decl.inputs.values.iter() {
|
||||||
|
@ -345,7 +342,7 @@ crate fn get_all_types<'tcx>(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let mut args = FxHashSet::default();
|
let mut args = FxHashSet::default();
|
||||||
get_real_types(generics, &arg.type_, tcx, 0, cache, &mut args);
|
get_real_types(generics, &arg.type_, tcx, 0, &mut args);
|
||||||
if !args.is_empty() {
|
if !args.is_empty() {
|
||||||
all_types.extend(args);
|
all_types.extend(args);
|
||||||
} else {
|
} else {
|
||||||
|
@ -358,7 +355,7 @@ crate fn get_all_types<'tcx>(
|
||||||
let ret_types = match decl.output {
|
let ret_types = match decl.output {
|
||||||
FnRetTy::Return(ref return_type) => {
|
FnRetTy::Return(ref return_type) => {
|
||||||
let mut ret = FxHashSet::default();
|
let mut ret = FxHashSet::default();
|
||||||
get_real_types(generics, &return_type, tcx, 0, cache, &mut ret);
|
get_real_types(generics, &return_type, tcx, 0, &mut ret);
|
||||||
if ret.is_empty() {
|
if ret.is_empty() {
|
||||||
if let Some(kind) = return_type.def_id().map(|did| tcx.def_kind(did).into()) {
|
if let Some(kind) = return_type.def_id().map(|did| tcx.def_kind(did).into()) {
|
||||||
ret.insert((return_type.clone(), kind));
|
ret.insert((return_type.clone(), kind));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue