Skip to content

Commit

Permalink
Tiny optimization: do not downgrade owned access to shared one
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhenrymantilla committed May 27, 2023
1 parent c3fcc17 commit a1f3226
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib.rs
Expand Up @@ -757,7 +757,8 @@ pub mod unsync {
let cell = this.cell;
let init = this.init;
cell.into_inner().ok_or_else(|| {
init.take().unwrap_or_else(|| panic!("Lazy instance has previously been poisoned"))
init.into_inner()
.unwrap_or_else(|| panic!("Lazy instance has previously been poisoned"))
})
}
}
Expand Down Expand Up @@ -1288,7 +1289,8 @@ pub mod sync {
let cell = this.cell;
let init = this.init;
cell.into_inner().ok_or_else(|| {
init.take().unwrap_or_else(|| panic!("Lazy instance has previously been poisoned"))
init.into_inner()
.unwrap_or_else(|| panic!("Lazy instance has previously been poisoned"))
})
}
}
Expand Down

0 comments on commit a1f3226

Please sign in to comment.