diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 9a5e929d85f2d..365ad880c4b18 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -246,6 +246,10 @@ impl OutputTypes { self.0.values() } + pub fn len(&self) -> usize { + self.0.len() + } + // True if any of the output types require codegen or linking. pub fn should_trans(&self) -> bool { self.0.keys().any(|k| match *k { diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index a3115544f30b9..44fc819ebb777 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -168,7 +168,7 @@ pub fn compile_input(trans: Box, write_out_deps(sess, &outputs, &output_paths); if sess.opts.output_types.contains_key(&OutputType::DepInfo) && - sess.opts.output_types.keys().count() == 1 { + sess.opts.output_types.len() == 1 { return Ok(()) } diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 77e916305c5b3..3eefe68fb1fd9 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -835,7 +835,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { fn metadata_output_only(&self) -> bool { // MIR optimisation can be skipped when we're just interested in the metadata. - self.tcx.sess.opts.output_types.keys().count() == 1 && + self.tcx.sess.opts.output_types.len() == 1 && self.tcx.sess.opts.output_types.contains_key(&OutputType::Metadata) }