Skip to content

Commit d223c28

Browse files
committed
Remove unnecessary Option
1 parent efb5616 commit d223c28

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

crates/hir-ty/src/db.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
156156
&self,
157157
projection: crate::ProjectionTy,
158158
env: Arc<crate::TraitEnvironment>,
159-
) -> Option<crate::Ty>;
159+
) -> Ty;
160160

161161
#[salsa::invoke(trait_solve_wait)]
162162
#[salsa::transparent]

crates/hir-ty/src/traits.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ pub(crate) fn normalize_projection_query(
6969
db: &dyn HirDatabase,
7070
projection: ProjectionTy,
7171
env: Arc<TraitEnvironment>,
72-
) -> Option<Ty> {
73-
let mut table = InferenceTable::new(db, env.clone());
72+
) -> Ty {
73+
let mut table = InferenceTable::new(db, env);
7474
let ty = table.normalize_projection_ty(projection);
75-
Some(table.resolve_completely(ty))
75+
table.resolve_completely(ty)
7676
}
7777

7878
/// Solve a trait goal using Chalk.

crates/hir/src/lib.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -2880,7 +2880,12 @@ impl Type {
28802880
})
28812881
.build();
28822882

2883-
db.normalize_projection(projection, self.env.clone()).map(|ty| self.derived(ty))
2883+
let ty = db.normalize_projection(projection, self.env.clone());
2884+
if ty.is_unknown() {
2885+
None
2886+
} else {
2887+
Some(self.derived(ty))
2888+
}
28842889
}
28852890

28862891
pub fn is_copy(&self, db: &dyn HirDatabase) -> bool {

0 commit comments

Comments
 (0)