From 51b194f09ab907a388ff7e9799940380d05f7347 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Wed, 22 Apr 2020 09:18:54 -0600 Subject: [PATCH] remove some extra } --- src/librustc_data_structures/profiling.rs | 58 +++++++++++------------ 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/src/librustc_data_structures/profiling.rs b/src/librustc_data_structures/profiling.rs index e2a1ba3a24b..07d16c6483e 100644 --- a/src/librustc_data_structures/profiling.rs +++ b/src/librustc_data_structures/profiling.rs @@ -607,39 +607,37 @@ pub fn duration_to_secs_str(dur: std::time::Duration) -> String { } // Memory reporting - cfg_if! { - if #[cfg(windows)] { - fn get_resident() -> Option { - use std::mem::{self, MaybeUninit}; - use winapi::shared::minwindef::DWORD; - use winapi::um::processthreadsapi::GetCurrentProcess; - use winapi::um::psapi::{GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS}; - - let mut pmc = MaybeUninit::::uninit(); - match unsafe { - GetProcessMemoryInfo(GetCurrentProcess(), pmc.as_mut_ptr(), mem::size_of_val(&pmc) as DWORD) - } { - 0 => None, - _ => { - let pmc = unsafe { pmc.assume_init() }; - Some(pmc.WorkingSetSize as usize) - } +cfg_if! { + if #[cfg(windows)] { + fn get_resident() -> Option { + use std::mem::{self, MaybeUninit}; + use winapi::shared::minwindef::DWORD; + use winapi::um::processthreadsapi::GetCurrentProcess; + use winapi::um::psapi::{GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS}; + + let mut pmc = MaybeUninit::::uninit(); + match unsafe { + GetProcessMemoryInfo(GetCurrentProcess(), pmc.as_mut_ptr(), mem::size_of_val(&pmc) as DWORD) + } { + 0 => None, + _ => { + let pmc = unsafe { pmc.assume_init() }; + Some(pmc.WorkingSetSize as usize) } } - } else if #[cfg(unix)] { - fn get_resident() -> Option { - let field = 1; - let contents = fs::read("/proc/self/statm").ok()?; - let contents = String::from_utf8(contents).ok()?; - let s = contents.split_whitespace().nth(field)?; - let npages = s.parse::().ok()?; - Some(npages * 4096) - } - } else { - fn get_resident() -> Option { - None - } } + } else if #[cfg(unix)] { + fn get_resident() -> Option { + let field = 1; + let contents = fs::read("/proc/self/statm").ok()?; + let contents = String::from_utf8(contents).ok()?; + let s = contents.split_whitespace().nth(field)?; + let npages = s.parse::().ok()?; + Some(npages * 4096) + } + } else { + fn get_resident() -> Option { + None } } } -- 2.44.0