File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 119119//! drop(file); 
120120//! ``` 
121121//! 
122- //! If you *do* write that in Rust, the compiler will by  give you a 
122+ //! If you *do* write that in Rust, the compiler will give you a 
123123//! warning (by default, controlled by the `unused_must_use` lint). 
124124//! 
125125//! You might instead, if you don't want to handle the error, simply 
178178//! fn write_info(info: &Info) -> Result<(), IoError> { 
179179//!     let mut file = File::open_mode(&Path::new("my_best_friends.txt"), Open, Write); 
180180//!     // Early return on error 
181- //!     match file.write_line(format!("name: {}", info.name).as_slice()) { 
182- //!         Ok(_) => (), 
183- //!         Err(e) => return Err(e) 
181+ //!     if let Err(e) = file.write_line(format!("name: {}", info.name).as_slice()) { 
182+ //!         return Err(e) 
184183//!     } 
185- //!     match file.write_line(format!("age: {}", info.age).as_slice()) { 
186- //!         Ok(_) => (), 
187- //!         Err(e) => return Err(e) 
184+ //!     if let Err(e) = file.write_line(format!("age: {}", info.age).as_slice()) { 
185+ //!         return Err(e) 
188186//!     } 
189187//!     return file.write_line(format!("rating: {}", info.rating).as_slice()); 
190188//! } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments