mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 04:39:16 +00:00
Clean up
This commit is contained in:
parent
de074fe636
commit
6c366ade00
@ -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)
|
||||
}
|
||||
|
@ -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 =
|
||||
|
@ -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) }
|
||||
}
|
||||
|
@ -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!()
|
||||
|
Loading…
Reference in New Issue
Block a user