Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f444a31 + 78cfe57 commit f5a9b4eCopy full SHA for f5a9b4e
src/lib.rs
@@ -59,8 +59,6 @@ extern crate test;
59
use tables::charwidth as cw;
60
pub use tables::UNICODE_VERSION;
61
62
-use core::ops::Add;
63
-
64
mod tables;
65
66
#[cfg(test)]
@@ -121,11 +119,11 @@ pub trait UnicodeWidthStr {
121
119
impl UnicodeWidthStr for str {
122
120
#[inline]
123
fn width(&self) -> usize {
124
- self.chars().map(|c| cw::width(c, false).unwrap_or(0)).fold(0, Add::add)
+ self.chars().map(|c| cw::width(c, false).unwrap_or(0)).sum()
125
}
126
127
128
fn width_cjk(&self) -> usize {
129
- self.chars().map(|c| cw::width(c, true).unwrap_or(0)).fold(0, Add::add)
+ self.chars().map(|c| cw::width(c, true).unwrap_or(0)).sum()
130
131
0 commit comments