Skip to content

Commit

Permalink
refactor(shell): Remove unused write_stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Oct 25, 2023
1 parent 6a390da commit de691b9
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/cargo/core/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,6 @@ impl Shell {
}
}

/// Write a styled fragment
///
/// Caller is responsible for deciding whether [`Shell::verbosity`] is affects output.
pub fn write_stdout(&mut self, fragment: impl fmt::Display, color: &Style) -> CargoResult<()> {
self.output.write_stdout(fragment, color)
}

/// Prints a message to stderr and translates ANSI escape code into console colors.
pub fn print_ansi_stderr(&mut self, message: &[u8]) -> CargoResult<()> {
if self.needs_clear {
Expand Down Expand Up @@ -409,17 +402,6 @@ impl ShellOut {
Ok(())
}

/// Write a styled fragment
fn write_stdout(&mut self, fragment: impl fmt::Display, style: &Style) -> CargoResult<()> {
let style = style.render();
let reset = anstyle::Reset.render();

let mut buffer = Vec::new();
write!(buffer, "{style}{}{reset}", fragment)?;
self.stdout().write_all(&buffer)?;
Ok(())
}

/// Gets stdout as a `io::Write`.
fn stdout(&mut self) -> &mut dyn Write {
match *self {
Expand Down

0 comments on commit de691b9

Please sign in to comment.