From c5e2fb1787686e4e202d64685b2792c83978ad0b Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 27 Feb 2018 01:23:10 -0500 Subject: fmt --- src/vcs/git.rs | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/vcs/git.rs b/src/vcs/git.rs index ddbdfcc..29d50da 100644 --- a/src/vcs/git.rs +++ b/src/vcs/git.rs @@ -16,7 +16,8 @@ pub struct GitInfo { impl GitInfo { pub fn new(git: &git2::Repository) -> GitInfo { - #[cfg(feature="verbose")] let now = std::time::Instant::now(); + #[cfg(feature = "verbose")] + let now = std::time::Instant::now(); let mut modified_statuses = git2::Status::empty(); modified_statuses.insert(git2::STATUS_WT_DELETED); @@ -33,7 +34,8 @@ impl GitInfo { let mut new_statuses = git2::Status::empty(); new_statuses.insert(git2::STATUS_WT_NEW); - #[cfg(feature="verbose")] let now = talk_about_time(now, "status bitsets"); + #[cfg(feature = "verbose")] + let now = talk_about_time(now, "status bitsets"); let mut status_options = git2::StatusOptions::new(); status_options.include_untracked(true); @@ -45,9 +47,11 @@ impl GitInfo { status_options.update_index(false); status_options.no_refresh(true); } - #[cfg(feature="verbose")] let now = talk_about_time(now, "status options"); + #[cfg(feature = "verbose")] + let now = talk_about_time(now, "status options"); let status = git.statuses(Some(&mut status_options)); - #[cfg(feature="verbose")] let now = talk_about_time(now, "statuses"); + #[cfg(feature = "verbose")] + let now = talk_about_time(now, "statuses"); let mut modified_files = false; let mut staged_files = false; let mut new_files = false; @@ -64,10 +68,12 @@ impl GitInfo { } } } - #[cfg(feature="verbose")] let now = talk_about_time(now, "status iteration"); + #[cfg(feature = "verbose")] + let now = talk_about_time(now, "status iteration"); let head = git.head(); - #[cfg(feature="verbose")] let now = talk_about_time(now, "head"); + #[cfg(feature = "verbose")] + let now = talk_about_time(now, "head"); let commits = head.is_ok(); let branch = head.ok().and_then(|head| { if head.is_branch() { @@ -86,7 +92,8 @@ impl GitInfo { ) } }); - #[cfg(feature="verbose")] let now = talk_about_time(now, "branch"); + #[cfg(feature = "verbose")] + let now = talk_about_time(now, "branch"); let active_operation = match git.state() { git2::RepositoryState::Merge => super::ActiveOperation::Merge, @@ -106,7 +113,8 @@ impl GitInfo { } _ => super::ActiveOperation::None, }; - #[cfg(feature="verbose")] let now = talk_about_time(now, "active operation"); + #[cfg(feature = "verbose")] + let now = talk_about_time(now, "active operation"); let remote_branch_diff = git.head() .ok() @@ -135,7 +143,8 @@ impl GitInfo { }) }) }); - #[cfg(feature="verbose")] let _ = talk_about_time(now, "remote branch diff"); + #[cfg(feature = "verbose")] + let _ = talk_about_time(now, "remote branch diff"); GitInfo { modified_files, @@ -149,10 +158,18 @@ impl GitInfo { } } -#[cfg(feature="verbose")] -fn talk_about_time(now: std::time::Instant, what: &str) -> std::time::Instant { +#[cfg(feature = "verbose")] +fn talk_about_time( + now: std::time::Instant, + what: &str, +) -> std::time::Instant { let elapsed = now.elapsed(); - println!("calculating {} took {}.{:09}s", what, elapsed.as_secs(), elapsed.subsec_nanos()); + println!( + "calculating {} took {}.{:09}s", + what, + elapsed.as_secs(), + elapsed.subsec_nanos() + ); std::time::Instant::now() } -- cgit v1.2.3-54-g00ecf