Skip to content

Commit 308f381

Browse files
committed
Add len() method to OutputTypes
1 parent f15e5c1 commit 308f381

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/librustc/session/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ impl OutputTypes {
246246
self.0.values()
247247
}
248248

249+
pub fn len(&self) -> usize {
250+
self.0.keys().count()
251+
}
252+
249253
// True if any of the output types require codegen or linking.
250254
pub fn should_trans(&self) -> bool {
251255
self.0.keys().any(|k| match *k {

src/librustc_driver/driver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ pub fn compile_input(trans: Box<TransCrate>,
168168

169169
write_out_deps(sess, &outputs, &output_paths);
170170
if sess.opts.output_types.contains_key(&OutputType::DepInfo) &&
171-
sess.opts.output_types.keys().count() == 1 {
171+
sess.opts.output_types.len() == 1 {
172172
return Ok(())
173173
}
174174

src/librustc_metadata/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
835835

836836
fn metadata_output_only(&self) -> bool {
837837
// MIR optimisation can be skipped when we're just interested in the metadata.
838-
self.tcx.sess.opts.output_types.keys().count() == 1 &&
838+
self.tcx.sess.opts.output_types.len() == 1 &&
839839
self.tcx.sess.opts.output_types.contains_key(&OutputType::Metadata)
840840
}
841841

0 commit comments

Comments
 (0)