diff --git a/Cargo.lock b/Cargo.lock index 59192e592..030b7ae9f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3794,7 +3794,7 @@ dependencies = [ "bitflags 1.2.1", "image", "log", - "num", + "num-traits 0.2.12", "ordered-float", "palette", "pretty_assertions", diff --git a/term/Cargo.toml b/term/Cargo.toml index a1743caf2..7520998b1 100644 --- a/term/Cargo.toml +++ b/term/Cargo.toml @@ -18,7 +18,7 @@ bitflags = "1.0" anyhow = "1.0" image = "0.23" log = "0.4" -num = "0.2" +num-traits = "0.2" ordered-float = "1.0" palette = "0.5" unicode-segmentation = "1.6" diff --git a/term/src/terminalstate.rs b/term/src/terminalstate.rs index 9b5fea49e..e813b61de 100644 --- a/term/src/terminalstate.rs +++ b/term/src/terminalstate.rs @@ -6,6 +6,7 @@ use crate::color::{ColorPalette, RgbColor}; use anyhow::bail; use image::{self, GenericImageView}; use log::{debug, error}; +use num_traits::FromPrimitive; use ordered_float::NotNan; use std::collections::HashMap; use std::fmt::Write; @@ -2222,7 +2223,7 @@ impl<'a> Performer<'a> { use termwiz::escape::osc::DynamicColorNumber; let mut idx: u8 = first_color as u8; for color in colors { - let which_color: Option = num::FromPrimitive::from_u8(idx); + let which_color: Option = FromPrimitive::from_u8(idx); log::trace!("ChangeDynamicColors item: {:?}", which_color); if let Some(which_color) = which_color { macro_rules! set_or_query { @@ -2264,8 +2265,7 @@ impl<'a> Performer<'a> { OperatingSystemCommand::ResetDynamicColor(color) => { log::trace!("ResetDynamicColor: {:?}", color); use termwiz::escape::osc::DynamicColorNumber; - let which_color: Option = - num::FromPrimitive::from_u8(color as u8); + let which_color: Option = FromPrimitive::from_u8(color as u8); if let Some(which_color) = which_color { macro_rules! reset { ($name:ident) => { diff --git a/termwiz/src/render/windows.rs b/termwiz/src/render/windows.rs index 4c44ca69c..486f4c9d4 100644 --- a/termwiz/src/render/windows.rs +++ b/termwiz/src/render/windows.rs @@ -5,7 +5,7 @@ use crate::cell::{AttributeChange, CellAttributes, Underline}; use crate::color::{AnsiColor, ColorAttribute}; use crate::surface::{Change, Position}; use crate::terminal::windows::ConsoleOutputHandle; -use num; +use num_traits::FromPrimitive; use std::io::Write; use winapi::shared::minwindef::WORD; use winapi::um::wincon::{ @@ -31,7 +31,7 @@ fn to_attr_word(attr: &CellAttributes) -> u16 { ($idx:expr, $default:ident, $red:ident, $green:ident, $blue:ident, $bright:ident, $( ($variant:ident, $bits:expr) ),*) =>{ - match num::FromPrimitive::from_u8($idx).unwrap_or(AnsiColor::$default) { + match FromPrimitive::from_u8($idx).unwrap_or(AnsiColor::$default) { $( AnsiColor::$variant => $bits, )*