From d36b41e063f497f1a597e958f72e91cdde978889 Mon Sep 17 00:00:00 2001 From: David Stangl Date: Thu, 2 Jan 2020 14:15:15 +0100 Subject: [PATCH] Fix mismatched unicode feature names --- src/utils.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index c0e01087..669c488b 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -598,24 +598,24 @@ impl<'a> Iterator for AnsiCodeIterator<'a> { } fn str_width(s: &str) -> usize { - #[cfg(feature = "unicode")] + #[cfg(feature = "unicode-width")] { use unicode_width::UnicodeWidthStr; s.width() } - #[cfg(not(feature = "unicode"))] + #[cfg(not(feature = "unicode-width"))] { s.chars().count() } } fn char_width(c: char) -> usize { - #[cfg(feature = "unicode")] + #[cfg(feature = "unicode-width")] { use unicode_width::UnicodeWidthChar; c.width().unwrap_or(0) } - #[cfg(not(feature = "unicode"))] + #[cfg(not(feature = "unicode-width"))] { let _c = c; 1 @@ -744,7 +744,7 @@ fn test_text_width() { } #[test] -#[cfg(feature = "unicode")] +#[cfg(feature = "unicode-width")] fn test_truncate_str() { let s = format!("foo {}", style("bar").red().force_styling(true)); assert_eq!(