rust: remove `atty` dependency
authorRaphaël Gomès <rgomes@octobus.net>
Mon, 04 Nov 2024 15:28:32 +0100
changeset 52313 56e8841a454c
parent 52312 492d167aa508
child 52314 33d8cb64e9da
rust: remove `atty` dependency It is fully replaced with the now stable `std::io::IsTerminal` trait. This was the last dependency flagged as a warning by `cargo audit`, aside from `cpython` which we know about all too well: the plan is to transition to PyO3 soon-ish.
rust/Cargo.lock
rust/rhg/Cargo.toml
rust/rhg/src/ui.rs
--- a/rust/Cargo.lock	Mon Nov 04 15:33:17 2024 +0100
+++ b/rust/Cargo.lock	Mon Nov 04 15:28:32 2024 +0100
@@ -1189,7 +1189,6 @@
 name = "rhg"
 version = "0.1.0"
 dependencies = [
- "atty",
  "chrono",
  "clap",
  "derive_more",
--- a/rust/rhg/Cargo.toml	Mon Nov 04 15:33:17 2024 +0100
+++ b/rust/rhg/Cargo.toml	Mon Nov 04 15:28:32 2024 +0100
@@ -8,7 +8,6 @@
 edition = "2021"
 
 [dependencies]
-atty = "0.2.14"
 hg-core = { path = "../hg-core"}
 chrono = "0.4.23"
 clap = { version = "4", features = ["cargo"] }
--- a/rust/rhg/src/ui.rs	Mon Nov 04 15:33:17 2024 +0100
+++ b/rust/rhg/src/ui.rs	Mon Nov 04 15:28:32 2024 +0100
@@ -12,6 +12,7 @@
 use hg::utils::files::get_bytes_from_path;
 use std::borrow::Cow;
 use std::io;
+use std::io::IsTerminal;
 use std::io::{ErrorKind, Write};
 
 pub struct Ui {
@@ -237,7 +238,7 @@
     Ok(if config.get_bool(b"ui", b"nontty")? {
         false
     } else {
-        atty::is(atty::Stream::Stdout)
+        std::io::stdout().is_terminal()
     })
 }