File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -50,8 +50,12 @@ impl PyConfig {
5050
5151    /// Get a configuration option 
5252     pub  fn  get < ' py > ( & self ,  key :  & str ,  py :  Python < ' py > )  -> PyResult < Bound < ' py ,  PyAny > >  { 
53-         let  options = self . config . read ( ) ; 
54-         for  entry in  options. entries ( )  { 
53+         let  entries = { 
54+             let  options = self . config . read ( ) ; 
55+             options. entries ( ) 
56+         } ; 
57+ 
58+         for  entry in  entries { 
5559            if  entry. key  == key { 
5660                return  Ok ( entry. value . into_pyobject ( py) ?) ; 
5761            } 
@@ -69,10 +73,14 @@ impl PyConfig {
6973
7074    /// Get all configuration options 
7175     pub  fn  get_all ( & self ,  py :  Python )  -> PyResult < PyObject >  { 
76+         let  entries = { 
77+             let  options = self . config . read ( ) ; 
78+             options. entries ( ) 
79+         } ; 
80+ 
7281        let  dict = PyDict :: new ( py) ; 
73-         let  options = self . config . read ( ) ; 
74-         for  entry in  options. entries ( )  { 
75-             dict. set_item ( entry. key ,  entry. value . clone ( ) . into_pyobject ( py) ?) ?; 
82+         for  entry in  entries { 
83+             dict. set_item ( entry. key ,  entry. value . into_pyobject ( py) ?) ?; 
7684        } 
7785        Ok ( dict. into ( ) ) 
7886    } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments