diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs index 367322ed293..e1193c402a3 100644 --- a/crates/ra_hir/src/ty/traits.rs +++ b/crates/ra_hir/src/ty/traits.rs @@ -348,13 +348,13 @@ pub(crate) fn implements( // relevant for our use cases?) let u_canonical = chalk_ir::UCanonical { canonical, universes: 1 }; let solution = solve(db, krate, &u_canonical); - solution_from_chalk(db, solution) + solution.map(|solution| solution_from_chalk(db, solution)) } fn solution_from_chalk( db: &impl HirDatabase, - solution: Option, -) -> Option { + solution: chalk_solve::Solution, +) -> Solution { let convert_subst = |subst: chalk_ir::Canonical| { let value = subst .value @@ -372,23 +372,22 @@ fn solution_from_chalk( SolutionVariables(result) }; match solution { - Some(chalk_solve::Solution::Unique(constr_subst)) => { + chalk_solve::Solution::Unique(constr_subst) => { let subst = chalk_ir::Canonical { value: constr_subst.value.subst, binders: constr_subst.binders, }; - Some(Solution::Unique(convert_subst(subst))) + Solution::Unique(convert_subst(subst)) } - Some(chalk_solve::Solution::Ambig(chalk_solve::Guidance::Definite(subst))) => { - Some(Solution::Ambig(Guidance::Definite(convert_subst(subst)))) + chalk_solve::Solution::Ambig(chalk_solve::Guidance::Definite(subst)) => { + Solution::Ambig(Guidance::Definite(convert_subst(subst))) } - Some(chalk_solve::Solution::Ambig(chalk_solve::Guidance::Suggested(subst))) => { - Some(Solution::Ambig(Guidance::Suggested(convert_subst(subst)))) + chalk_solve::Solution::Ambig(chalk_solve::Guidance::Suggested(subst)) => { + Solution::Ambig(Guidance::Suggested(convert_subst(subst))) } - Some(chalk_solve::Solution::Ambig(chalk_solve::Guidance::Unknown)) => { - Some(Solution::Ambig(Guidance::Unknown)) + chalk_solve::Solution::Ambig(chalk_solve::Guidance::Unknown) => { + Solution::Ambig(Guidance::Unknown) } - None => None, } }