style: Simplify initialization of thread_state.

This commit is contained in:
Emilio Cobos Álvarez 2016-12-25 17:32:35 +01:00
parent eaf69c29ec
commit 6264268c82
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -60,10 +60,9 @@ mod imp {
pub fn initialize(x: ThreadState) {
STATE.with(|ref k| {
match *k.borrow() {
Some(s) => panic!("Thread state already initialized as {:?}", s),
None => ()
};
if let Some(ref s) = *k.borrow() {
panic!("Thread state already initialized as {:?}", s);
}
*k.borrow_mut() = Some(x);
});
get(); // check the assertion below