mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
style: Simplify initialization of thread_state.
This commit is contained in:
parent
eaf69c29ec
commit
6264268c82
1 changed files with 3 additions and 4 deletions
|
@ -60,10 +60,9 @@ mod imp {
|
||||||
|
|
||||||
pub fn initialize(x: ThreadState) {
|
pub fn initialize(x: ThreadState) {
|
||||||
STATE.with(|ref k| {
|
STATE.with(|ref k| {
|
||||||
match *k.borrow() {
|
if let Some(ref s) = *k.borrow() {
|
||||||
Some(s) => panic!("Thread state already initialized as {:?}", s),
|
panic!("Thread state already initialized as {:?}", s);
|
||||||
None => ()
|
}
|
||||||
};
|
|
||||||
*k.borrow_mut() = Some(x);
|
*k.borrow_mut() = Some(x);
|
||||||
});
|
});
|
||||||
get(); // check the assertion below
|
get(); // check the assertion below
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue