diff options
| author | Ralf Jung <post@ralfj.de> | 2023-02-18 19:28:51 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-02-18 19:28:51 +0100 |
| commit | 036929d86dc03197668cd9c6673dcbc4e42dfb17 (patch) | |
| tree | 3f8cc5587335245d0f5143a31d6971e224f0cf4a /compiler/rustc_data_structures | |
| parent | aed3b3f38c58714a037c2af47f5c276c135c226f (diff) | |
| parent | 5643706ca2ca59a47966c03104d4b8d931adb2dd (diff) | |
| download | rust-036929d86dc03197668cd9c6673dcbc4e42dfb17.tar.gz rust-036929d86dc03197668cd9c6673dcbc4e42dfb17.zip | |
Merge from rustc
Diffstat (limited to 'compiler/rustc_data_structures')
| -rw-r--r-- | compiler/rustc_data_structures/src/profiling.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs index 3aca03f6e5c..44331683694 100644 --- a/compiler/rustc_data_structures/src/profiling.rs +++ b/compiler/rustc_data_structures/src/profiling.rs @@ -207,8 +207,7 @@ impl SelfProfilerRef { /// a measureme event, "verbose" generic activities also print a timing entry to /// stderr if the compiler is invoked with -Ztime-passes. pub fn verbose_generic_activity(&self, event_label: &'static str) -> VerboseTimingGuard<'_> { - let message = - if self.print_verbose_generic_activities { Some(event_label.to_owned()) } else { None }; + let message = self.print_verbose_generic_activities.then(|| event_label.to_owned()); VerboseTimingGuard::start(message, self.generic_activity(event_label)) } @@ -222,11 +221,9 @@ impl SelfProfilerRef { where A: Borrow<str> + Into<String>, { - let message = if self.print_verbose_generic_activities { - Some(format!("{}({})", event_label, event_arg.borrow())) - } else { - None - }; + let message = self + .print_verbose_generic_activities + .then(|| format!("{}({})", event_label, event_arg.borrow())); VerboseTimingGuard::start(message, self.generic_activity_with_arg(event_label, event_arg)) } |
