Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/layout/target.rs')
-rw-r--r--crates/hir-ty/src/layout/target.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/hir-ty/src/layout/target.rs b/crates/hir-ty/src/layout/target.rs
index 5bfe7bf010..9b1424548c 100644
--- a/crates/hir-ty/src/layout/target.rs
+++ b/crates/hir-ty/src/layout/target.rs
@@ -11,10 +11,8 @@ pub fn target_data_layout_query(
db: &dyn HirDatabase,
krate: CrateId,
) -> Result<Arc<TargetDataLayout>, Arc<str>> {
- let crate_graph = db.crate_graph();
- let res = crate_graph[krate].target_layout.as_deref();
- match res {
- Ok(it) => match TargetDataLayout::parse_from_llvm_datalayout_string(it) {
+ match db.data_layout(krate) {
+ Ok(it) => match TargetDataLayout::parse_from_llvm_datalayout_string(&it) {
Ok(it) => Ok(Arc::new(it)),
Err(e) => {
Err(match e {
@@ -44,6 +42,6 @@ pub fn target_data_layout_query(
}.into())
}
},
- Err(e) => Err(Arc::from(&**e)),
+ Err(e) => Err(e),
}
}