File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/tools/rust-analyzer/xtask/src Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ struct Host {
160160
161161impl Metrics {
162162 fn new ( sh : & Shell ) -> anyhow:: Result < Metrics > {
163- let host = Host :: new ( sh) ? ;
163+ let host = Host :: new ( sh) . unwrap_or_else ( |_| Host :: unknown ( ) ) ;
164164 let timestamp = SystemTime :: now ( ) ;
165165 let revision = cmd ! ( sh, "git rev-parse HEAD" ) . read ( ) ?;
166166 let perf_revision = "a584462e145a0c04760fd9391daefb4f6bd13a99" . into ( ) ;
@@ -191,9 +191,13 @@ impl Metrics {
191191}
192192
193193impl Host {
194+ fn unknown ( ) -> Host {
195+ Host { os : "unknown" . into ( ) , cpu : "unknown" . into ( ) , mem : "unknown" . into ( ) }
196+ }
197+
194198 fn new ( sh : & Shell ) -> anyhow:: Result < Host > {
195199 if cfg ! ( not( target_os = "linux" ) ) {
196- return Ok ( Host { os : "unknown" . into ( ) , cpu : " unknown" . into ( ) , mem : "unknown" . into ( ) } ) ;
200+ return Ok ( Host :: unknown ( ) ) ;
197201 }
198202
199203 let os = read_field ( sh, "/etc/os-release" , "PRETTY_NAME=" ) ?. trim_matches ( '"' ) . to_owned ( ) ;
You can’t perform that action at this time.
0 commit comments