From 6c366ade0087db292b9a1eee71b6a20653a4d0e9 Mon Sep 17 00:00:00 2001 From: Dawer <7803845+iDawer@users.noreply.github.com> Date: Thu, 12 Aug 2021 19:31:00 +0500 Subject: [PATCH] Clean up --- crates/hir_ty/src/display.rs | 6 +++--- crates/hir_ty/src/infer/coerce.rs | 1 - crates/hir_ty/src/lower.rs | 3 --- crates/ide_assists/src/handlers/generate_function.rs | 3 +-- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 2472d9ce20d..91c705afb78 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs @@ -377,7 +377,7 @@ impl HirDisplay for Ty { } // FIXME: all this just to decide whether to use parentheses... - let conains_impl_fn = |bounds: &[QuantifiedWhereClause]| { + let contains_impl_fn = |bounds: &[QuantifiedWhereClause]| { bounds.iter().any(|bound| { if let WhereClause::Implemented(trait_ref) = bound.skip_binders() { let trait_ = trait_ref.hir_trait_id(); @@ -390,7 +390,7 @@ impl HirDisplay for Ty { let (preds_to_print, has_impl_fn_pred) = match t.kind(&Interner) { TyKind::Dyn(dyn_ty) if dyn_ty.bounds.skip_binders().interned().len() > 1 => { let bounds = dyn_ty.bounds.skip_binders().interned(); - (bounds.len(), conains_impl_fn(bounds)) + (bounds.len(), contains_impl_fn(bounds)) } TyKind::Alias(AliasTy::Opaque(OpaqueTy { opaque_ty_id, @@ -435,7 +435,7 @@ impl HirDisplay for Ty { } } - (len, conains_impl_fn(bounds.skip_binders())) + (len, contains_impl_fn(bounds.skip_binders())) } else { (0, false) } diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs index 9543404114c..0f5859c433f 100644 --- a/crates/hir_ty/src/infer/coerce.rs +++ b/crates/hir_ty/src/infer/coerce.rs @@ -578,7 +578,6 @@ impl<'a> InferenceContext<'a> { Solution::Ambig(Guidance::Definite(subst)) => { canonicalized.apply_solution(&mut self.table, subst) } - // FIXME: should we accept ambiguous results here? _ => return Err(TypeError), }; let unsize = diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index b72e1fc46a1..582a5eb21da 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs @@ -881,8 +881,6 @@ impl<'a> TyLoweringContext<'a> { cov_mark::hit!(lower_rpit); let self_ty = TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)).intern(&Interner); - // XXX(iDawer): Can shifting mess with unsized_types? For now I better reinsure. - let outer_unsized_types = self.unsized_types.replace(Default::default()); let predicates = self.with_shifted_in(DebruijnIndex::ONE, |ctx| { let mut predicates: Vec<_> = bounds .iter() @@ -907,7 +905,6 @@ impl<'a> TyLoweringContext<'a> { } predicates }); - self.unsized_types.replace(outer_unsized_types); ReturnTypeImplTrait { bounds: crate::make_only_type_binders(1, predicates) } } diff --git a/crates/ide_assists/src/handlers/generate_function.rs b/crates/ide_assists/src/handlers/generate_function.rs index 20fe865884b..716a054be85 100644 --- a/crates/ide_assists/src/handlers/generate_function.rs +++ b/crates/ide_assists/src/handlers/generate_function.rs @@ -747,7 +747,7 @@ fn bar(worble: ()) ${0:-> ()} { check_assist( generate_function, r#" -#[lang = "sized"] trait Sized {} +//- minicore: sized trait Foo {} fn foo() -> impl Foo { todo!() @@ -757,7 +757,6 @@ fn baz() { } "#, r#" -#[lang = "sized"] trait Sized {} trait Foo {} fn foo() -> impl Foo { todo!()