]> git.lizzy.rs Git - rust.git/commitdiff
Use question_mark feature in librustc_incremental.
authorAhmed Charles <acharles@outlook.com>
Sat, 27 Aug 2016 09:31:17 +0000 (02:31 -0700)
committerAhmed Charles <acharles@outlook.com>
Sun, 11 Sep 2016 23:02:41 +0000 (16:02 -0700)
src/librustc_incremental/persist/hash.rs
src/librustc_incremental/persist/load.rs
src/librustc_incremental/persist/save.rs

index 95bee669d3256151cafdc3ba174f21ec4391e591..bafaafd4afa0e7c8ab34bfe165316701f143a56d 100644 (file)
@@ -194,7 +194,7 @@ fn load_from_data(&mut self,
 
         // Load up the hashes for the def-ids from this crate.
         let mut decoder = Decoder::new(data, 0);
-        let svh_in_hashes_file = try!(Svh::decode(&mut decoder));
+        let svh_in_hashes_file = Svh::decode(&mut decoder)?;
 
         if svh_in_hashes_file != expected_svh {
             // We should not be able to get here. If we do, then
@@ -202,7 +202,7 @@ fn load_from_data(&mut self,
             bug!("mismatch between SVH in crate and SVH in incr. comp. hashes")
         }
 
-        let serialized_hashes = try!(SerializedMetadataHashes::decode(&mut decoder));
+        let serialized_hashes = SerializedMetadataHashes::decode(&mut decoder)?;
         for serialized_hash in serialized_hashes.hashes {
             // the hashes are stored with just a def-index, which is
             // always relative to the old crate; convert that to use
index 48f95430f26b6f47c650bb003b07924a0dee6c56..6e6464e49683a9d108c5d6bd70672b014344975b 100644 (file)
@@ -125,11 +125,11 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 {
     // Decode the list of work_products
     let mut work_product_decoder = Decoder::new(work_products_data, 0);
-    let work_products = try!(<Vec<SerializedWorkProduct>>::decode(&mut work_product_decoder));
+    let work_products = <Vec<SerializedWorkProduct>>::decode(&mut work_product_decoder)?;
 
     // Deserialize the directory and dep-graph.
     let mut dep_graph_decoder = Decoder::new(dep_graph_data, 0);
-    let prev_commandline_args_hash = try!(u64::decode(&mut dep_graph_decoder));
+    let prev_commandline_args_hash = u64::decode(&mut dep_graph_decoder)?;
 
     if prev_commandline_args_hash != tcx.sess.opts.dep_tracking_hash() {
         // We can't reuse the cache, purge it.
@@ -142,8 +142,8 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         return Ok(());
     }
 
-    let directory = try!(DefIdDirectory::decode(&mut dep_graph_decoder));
-    let serialized_dep_graph = try!(SerializedDepGraph::decode(&mut dep_graph_decoder));
+    let directory = DefIdDirectory::decode(&mut dep_graph_decoder)?;
+    let serialized_dep_graph = SerializedDepGraph::decode(&mut dep_graph_decoder)?;
 
     // Retrace the paths in the directory to find their current location (if any).
     let retraced = directory.retrace(tcx);
index d31252be5e857295bce2ea16ffb321148e009c66..41212d8e138da66e52396cc1e889f93ba493e080 100644 (file)
@@ -110,7 +110,7 @@ pub fn encode_dep_graph(preds: &Predecessors,
                         -> io::Result<()> {
     // First encode the commandline arguments hash
     let tcx = builder.tcx();
-    try!(tcx.sess.opts.dep_tracking_hash().encode(encoder));
+    tcx.sess.opts.dep_tracking_hash().encode(encoder)?;
 
     // Create a flat list of (Input, WorkProduct) edges for
     // serialization.
@@ -149,8 +149,8 @@ pub fn encode_dep_graph(preds: &Predecessors,
     debug!("graph = {:#?}", graph);
 
     // Encode the directory and then the graph data.
-    try!(builder.directory().encode(encoder));
-    try!(graph.encode(encoder));
+    builder.directory().encode(encoder)?;
+    graph.encode(encoder)?;
 
     Ok(())
 }
@@ -222,8 +222,8 @@ pub fn encode_metadata_hashes(tcx: TyCtxt,
     }
 
     // Encode everything.
-    try!(svh.encode(encoder));
-    try!(serialized_hashes.encode(encoder));
+    svh.encode(encoder)?;
+    serialized_hashes.encode(encoder)?;
 
     Ok(())
 }