Skip to content

Commit

Permalink
rust-project: Use whoami::fallible::hostname in logging
Browse files Browse the repository at this point in the history
Summary: `whoami::hostname` is deprecated. Replace it with its recommended alternative.

Reviewed By: davidbarsky, dtolnay

Differential Revision: D68848530

fbshipit-source-id: 6e6d2b2dbbcee61326c04c38ae445f2a43ed4eb7
  • Loading branch information
darichey authored and facebook-github-bot committed Jan 29, 2025
1 parent 8806bf5 commit ffeeb13
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions integrations/rust-project/src/scuba.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
* of this source tree.
*/

#![allow(deprecated)] // whoami::hostname is deprecated

use std::path::Path;
use std::time::Duration;

Expand Down Expand Up @@ -82,7 +80,12 @@ fn new_sample(kind: &str) -> scuba::ScubaSampleBuilder {
let mut sample = scuba::ScubaSampleBuilder::new(fb, "rust_project");
sample.add("root_span", kind);
sample.add("unixname", whoami::username());
sample.add("hostname", whoami::hostname());
sample.add(
"hostname",
whoami::fallible::hostname()
.unwrap_or("unknown hostname".to_owned())
.to_ascii_lowercase(),
);

// RA_PROXY_SESSION_ID is an environment variable set by the VS Code extension when it starts
// rust-analyzer-proxy. rust-analyzer-proxy then starts rust-analyzer with the same
Expand Down

0 comments on commit ffeeb13

Please sign in to comment.