@@ -150,9 +150,8 @@ impl Drop for _InsnCtxt {
150150pub fn push_ctxt ( s : & ' static str ) -> _InsnCtxt {
151151 debug ! ( "new InsnCtxt: {}" , s) ;
152152 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)
156155 }
157156 } ) ;
158157 _InsnCtxt {
@@ -198,9 +197,8 @@ fn get_extern_rust_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
198197 name : & str ,
199198 did : DefId )
200199 -> 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;
204202 }
205203
206204 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>,
238236 -> ValueRef {
239237 let name = ccx. sess ( ) . cstore . item_symbol ( did) ;
240238 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;
244241 }
245242 // FIXME(nagisa): perhaps the map of externs could be offloaded to llvm somehow?
246243 // FIXME(nagisa): investigate whether it can be changed into define_global
@@ -2755,9 +2752,8 @@ fn contains_null(s: &str) -> bool {
27552752pub fn get_item_val ( ccx : & CrateContext , id : ast:: NodeId ) -> ValueRef {
27562753 debug ! ( "get_item_val(id=`{}`)" , id) ;
27572754
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;
27612757 }
27622758
27632759 let item = ccx. tcx ( ) . map . get ( id) ;
0 commit comments