comparison rust/rhg/src/ui.rs @ 52313:56e8841a454c

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.
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 04 Nov 2024 15:28:32 +0100
parents 22d24f6d6411
children
comparison
equal deleted inserted replaced
52312:492d167aa508 52313:56e8841a454c
10 use hg::repo::Repo; 10 use hg::repo::Repo;
11 use hg::sparse; 11 use hg::sparse;
12 use hg::utils::files::get_bytes_from_path; 12 use hg::utils::files::get_bytes_from_path;
13 use std::borrow::Cow; 13 use std::borrow::Cow;
14 use std::io; 14 use std::io;
15 use std::io::IsTerminal;
15 use std::io::{ErrorKind, Write}; 16 use std::io::{ErrorKind, Write};
16 17
17 pub struct Ui { 18 pub struct Ui {
18 stdout: std::io::Stdout, 19 stdout: std::io::Stdout,
19 stderr: std::io::Stderr, 20 stderr: std::io::Stderr,
235 236
236 fn isatty(config: &Config) -> Result<bool, HgError> { 237 fn isatty(config: &Config) -> Result<bool, HgError> {
237 Ok(if config.get_bool(b"ui", b"nontty")? { 238 Ok(if config.get_bool(b"ui", b"nontty")? {
238 false 239 false
239 } else { 240 } else {
240 atty::is(atty::Stream::Stdout) 241 std::io::stdout().is_terminal()
241 }) 242 })
242 } 243 }
243 244
244 /// Return the formatted bytestring corresponding to a pattern file warning, 245 /// Return the formatted bytestring corresponding to a pattern file warning,
245 /// as expected by the CLI. 246 /// as expected by the CLI.