Remove extra trait, clean up cfg statements
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Steve Pentland · committed by sharkdp · parent 6c7e102 · Browse files · 4 files·+28 added−23 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+28 added−23 removed
- other:+28 added−23 removed
Provenance
- Commit
cad3d0c- Tree
dcf8646- Author
Steve Pentland <stevepentland@gmail.com>- Committer
sharkdp <davidpeter@web.de>- Parent
6c7e102
4 files changed+28 added−23 removed
modified:src/hyperfine/timer/mod.rs+9 added-18 removed
1 mod internal;2 3 pub mod wallclocktimer;4 5-#[cfg(not(windows))]6-mod unix_timer;7-8-#[cfg(not(windows))]9-pub use self::unix_timer::get_cpu_timer;10-11-#[cfg(windows)]12-mod windows_timer;13-14-#[cfg(windows)]15-pub use self::windows_timer::get_cpu_timer;16-5+cfg_if! {6+ if #[cfg(windows)] {7+ mod windows_timer;8+ pub use self::windows_timer::get_cpu_timer;9+ } else {10+ mod unix_timer;11+ pub use self::unix_timer::get_cpu_timer;12+ }13+}14 use std::process::Child;15 19-pub trait Timer20-where21- Self: TimerStart + TimerStop,22-{23-}24-16 /// Defines start functionality of a timer.17 pub trait TimerStart {18 fn start() -> Self;19 fn start_for_process(process: &Child) -> Self;7 unmodified linesmodified:src/main.rs+11 added-5 removed
1 extern crate atty;2+3 #[macro_use]4+extern crate cfg_if;5+6+#[macro_use]7 extern crate clap;8 extern crate colored;9 extern crate indicatif;10 extern crate statistical;11 8-#[cfg(not(windows))]9-extern crate libc;12+cfg_if! {13+ if #[cfg(windows)] {14+ extern crate winapi;15+ } else {16+ extern crate libc;17+ }18+}19 11-#[cfg(windows)]12-extern crate winapi;13-20 #[cfg(test)]21 #[macro_use]22 extern crate approx;23 150 unmodified linesmodified:Cargo.lock+7 added
30 unmodified lines31 version = "1.0.1"32 source = "registry+https://github.com/rust-lang/crates.io-index"33 34 [[package]]35+name = "cfg-if"36+version = "0.1.2"37+source = "registry+https://github.com/rust-lang/crates.io-index"38+39+[[package]]40 name = "clap"41 version = "2.29.2"42 source = "registry+https://github.com/rust-lang/crates.io-index"43 dependencies = [59 unmodified lines103 version = "0.4.0"104 dependencies = [105 "approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",106 "atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",107+ "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",108 "clap 2.29.2 (registry+https://github.com/rust-lang/crates.io-index)",109 "colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",110 "indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",111 "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",309 unmodified lines421 "checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455"422 "checksum approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08abcc3b4e9339e33a3d0a5ed15d84a687350c05689d825e0f6655eef9e76a94"423 "checksum atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8352656fd42c30a0c3c89d26dea01e3b77c0ab2af18230835c15e2e13cd51859"424 "checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"425+"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"426 "checksum clap 2.29.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4151c5790817c7d21bbdc6c3530811f798172915f93258244948b93ba19604a6"427 "checksum clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f84dec9bc083ce2503908cd305af98bd363da6f54bf8d4bf0ac14ee749ad5d1"428 "checksum colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa3473e85a3161b59845d6096b289bb577874cafeaf75ea1b1beaa6572c7fc"429 "checksum console 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7649ca90478264b9686aac8d269fcb014f14c2bed7c79a7e51b9f6afd4d783eb"42 unmodified linesmodified:Cargo.toml+1 added
12 unmodified lines13141516171819202110 unmodified lines12 unmodified linescolored = "1.6"indicatif = "0.9"statistical = "0.1"atty = "0.2.2"cfg-if = "0.1.2"
[target.'cfg(not(windows))'.dependencies]libc = "0.2"
10 unmodified lines