mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Clean up
This commit is contained in:
parent
de074fe636
commit
6c366ade00
4 changed files with 4 additions and 9 deletions
|
@ -377,7 +377,7 @@ impl HirDisplay for Ty {
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: all this just to decide whether to use parentheses...
|
// 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| {
|
bounds.iter().any(|bound| {
|
||||||
if let WhereClause::Implemented(trait_ref) = bound.skip_binders() {
|
if let WhereClause::Implemented(trait_ref) = bound.skip_binders() {
|
||||||
let trait_ = trait_ref.hir_trait_id();
|
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) {
|
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 => {
|
TyKind::Dyn(dyn_ty) if dyn_ty.bounds.skip_binders().interned().len() > 1 => {
|
||||||
let bounds = dyn_ty.bounds.skip_binders().interned();
|
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 {
|
TyKind::Alias(AliasTy::Opaque(OpaqueTy {
|
||||||
opaque_ty_id,
|
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 {
|
} else {
|
||||||
(0, false)
|
(0, false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -578,7 +578,6 @@ impl<'a> InferenceContext<'a> {
|
||||||
Solution::Ambig(Guidance::Definite(subst)) => {
|
Solution::Ambig(Guidance::Definite(subst)) => {
|
||||||
canonicalized.apply_solution(&mut self.table, subst)
|
canonicalized.apply_solution(&mut self.table, subst)
|
||||||
}
|
}
|
||||||
// FIXME: should we accept ambiguous results here?
|
|
||||||
_ => return Err(TypeError),
|
_ => return Err(TypeError),
|
||||||
};
|
};
|
||||||
let unsize =
|
let unsize =
|
||||||
|
|
|
@ -881,8 +881,6 @@ impl<'a> TyLoweringContext<'a> {
|
||||||
cov_mark::hit!(lower_rpit);
|
cov_mark::hit!(lower_rpit);
|
||||||
let self_ty =
|
let self_ty =
|
||||||
TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)).intern(&Interner);
|
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 predicates = self.with_shifted_in(DebruijnIndex::ONE, |ctx| {
|
||||||
let mut predicates: Vec<_> = bounds
|
let mut predicates: Vec<_> = bounds
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -907,7 +905,6 @@ impl<'a> TyLoweringContext<'a> {
|
||||||
}
|
}
|
||||||
predicates
|
predicates
|
||||||
});
|
});
|
||||||
self.unsized_types.replace(outer_unsized_types);
|
|
||||||
|
|
||||||
ReturnTypeImplTrait { bounds: crate::make_only_type_binders(1, predicates) }
|
ReturnTypeImplTrait { bounds: crate::make_only_type_binders(1, predicates) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -747,7 +747,7 @@ fn bar(worble: ()) ${0:-> ()} {
|
||||||
check_assist(
|
check_assist(
|
||||||
generate_function,
|
generate_function,
|
||||||
r#"
|
r#"
|
||||||
#[lang = "sized"] trait Sized {}
|
//- minicore: sized
|
||||||
trait Foo {}
|
trait Foo {}
|
||||||
fn foo() -> impl Foo {
|
fn foo() -> impl Foo {
|
||||||
todo!()
|
todo!()
|
||||||
|
@ -757,7 +757,6 @@ fn baz() {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
r#"
|
r#"
|
||||||
#[lang = "sized"] trait Sized {}
|
|
||||||
trait Foo {}
|
trait Foo {}
|
||||||
fn foo() -> impl Foo {
|
fn foo() -> impl Foo {
|
||||||
todo!()
|
todo!()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue