@@ -150,9 +150,8 @@ impl Drop for _InsnCtxt {
150
150
pub fn push_ctxt ( s : & ' static str ) -> _InsnCtxt {
151
151
debug ! ( "new InsnCtxt: {}" , s) ;
152
152
TASK_LOCAL_INSN_KEY . with ( |slot| {
153
- match slot. borrow_mut ( ) . as_mut ( ) {
154
- Some ( ctx) => ctx. push ( s) ,
155
- None => { }
153
+ if let Some ( ctx) = slot. borrow_mut ( ) . as_mut ( ) {
154
+ ctx. push ( s)
156
155
}
157
156
} ) ;
158
157
_InsnCtxt {
@@ -198,9 +197,8 @@ fn get_extern_rust_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
198
197
name : & str ,
199
198
did : DefId )
200
199
-> ValueRef {
201
- match ccx. externs ( ) . borrow ( ) . get ( name) {
202
- Some ( n) => return * n,
203
- None => ( ) ,
200
+ if let Some ( n) = ccx. externs ( ) . borrow ( ) . get ( name) {
201
+ return * n;
204
202
}
205
203
206
204
let f = declare:: declare_rust_fn ( ccx, name, fn_ty) ;
@@ -238,9 +236,8 @@ pub fn get_extern_const<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
238
236
-> ValueRef {
239
237
let name = ccx. sess ( ) . cstore . item_symbol ( did) ;
240
238
let ty = type_of ( ccx, t) ;
241
- match ccx. externs ( ) . borrow_mut ( ) . get ( & name) {
242
- Some ( n) => return * n,
243
- None => ( ) ,
239
+ if let Some ( n) = ccx. externs ( ) . borrow_mut ( ) . get ( & name) {
240
+ return * n;
244
241
}
245
242
// FIXME(nagisa): perhaps the map of externs could be offloaded to llvm somehow?
246
243
// FIXME(nagisa): investigate whether it can be changed into define_global
@@ -2755,9 +2752,8 @@ fn contains_null(s: &str) -> bool {
2755
2752
pub fn get_item_val ( ccx : & CrateContext , id : ast:: NodeId ) -> ValueRef {
2756
2753
debug ! ( "get_item_val(id=`{}`)" , id) ;
2757
2754
2758
- match ccx. item_vals ( ) . borrow ( ) . get ( & id) . cloned ( ) {
2759
- Some ( v) => return v,
2760
- None => { }
2755
+ if let Some ( v) = ccx. item_vals ( ) . borrow ( ) . get ( & id) . cloned ( ) {
2756
+ return v;
2761
2757
}
2762
2758
2763
2759
let item = ccx. tcx ( ) . map . get ( id) ;
0 commit comments