diff options
author | Jeff Vander Stoep <jeffv@google.com> | 2024-02-06 08:50:57 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2024-02-06 08:50:57 +0000 |
commit | 802f1cdf8b813d19171eb7f86bbc30342ed9b7e9 (patch) | |
tree | 67a5849f296d7b65ab12e7beace86e5dbb4d7cf6 | |
parent | 9c524fdfb8801164774e15e348706c6cde585c8c (diff) | |
parent | ac13f2c1b0e90b4db3a78d3d23085ea85d071e45 (diff) | |
download | unicode-width-802f1cdf8b813d19171eb7f86bbc30342ed9b7e9.tar.gz |
Upgrade unicode-width to 0.1.11 am: ac13f2c1b0HEADmastermainemu-34-2-dev
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/unicode-width/+/2950617
Change-Id: I740aeff562efc6385baf89a6be0b9a74674eb222
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | .github/workflows/rust.yml | 28 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Android.bp | 4 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | Cargo.toml.orig | 2 | ||||
-rw-r--r-- | METADATA | 25 | ||||
-rwxr-xr-x | scripts/unicode.py | 4 | ||||
-rw-r--r-- | src/lib.rs | 6 | ||||
-rw-r--r-- | src/tables.rs | 6 |
10 files changed, 53 insertions, 28 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index df61a6c..be8a499 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,6 +1,6 @@ { "git": { - "sha1": "f444a314efeda9c130db6d6a96e925db0ea1ed13" + "sha1": "89424871950f91033de79cd06318d8c06d94df84" }, "path_in_vcs": "" }
\ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..89c5f57 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,28 @@ +name: Rust + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose + regen: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Regen + run: cd scripts && python3 unicode.py + - name: Diff + run: diff src/tables.rs scripts/tables.rs @@ -1,3 +1,5 @@ target Cargo.lock scripts/tmp +scripts/*.txt +scripts/*.rs @@ -43,7 +43,7 @@ rust_library { host_supported: true, crate_name: "unicode_width", cargo_env_compat: true, - cargo_pkg_version: "0.1.10", + cargo_pkg_version: "0.1.11", srcs: ["src/lib.rs"], edition: "2015", features: ["default"], @@ -60,7 +60,7 @@ rust_test { host_supported: true, crate_name: "unicode_width", cargo_env_compat: true, - cargo_pkg_version: "0.1.10", + cargo_pkg_version: "0.1.11", srcs: ["src/lib.rs"], test_suites: ["general-tests"], auto_gen_config: true, @@ -11,7 +11,7 @@ [package] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" authors = [ "kwantam <kwantam@gmail.com>", "Manish Goregaokar <manishsmail@gmail.com>", diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 993b35f..a0f16da 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,7 +1,7 @@ [package] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" authors = ["kwantam <kwantam@gmail.com>", "Manish Goregaokar <manishsmail@gmail.com>"] homepage = "https://github.com/unicode-rs/unicode-width" @@ -1,23 +1,20 @@ # This project was upgraded with external_updater. -# Usage: tools/external_updater/updater.sh update rust/crates/unicode-width -# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md +# Usage: tools/external_updater/updater.sh update external/rust/crates/unicode-width +# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md name: "unicode-width" description: "Determine displayed width of `char` and `str` types according to Unicode Standard Annex #11 rules." third_party { - url { - type: HOMEPAGE - value: "https://crates.io/crates/unicode-width" - } - url { - type: ARCHIVE - value: "https://static.crates.io/crates/unicode-width/unicode-width-0.1.10.crate" - } - version: "0.1.10" license_type: NOTICE last_upgrade_date { - year: 2022 - month: 12 - day: 19 + year: 2024 + month: 2 + day: 5 + } + homepage: "https://crates.io/crates/unicode-width" + identifier { + type: "Archive" + value: "https://static.crates.io/crates/unicode-width/unicode-width-0.1.11.crate" + version: "0.1.11" } } diff --git a/scripts/unicode.py b/scripts/unicode.py index 2efb0b6..a6d58c5 100755 --- a/scripts/unicode.py +++ b/scripts/unicode.py @@ -106,9 +106,9 @@ def load_east_asian_widths() -> "list[EffectiveWidth]": `Ambiguous` chracters are assigned `EffectiveWidth.AMBIGUOUS`.""" with fetch_open("EastAsianWidth.txt") as eaw: # matches a width assignment for a single codepoint, i.e. "1F336;N # ..." - single = re.compile(r"^([0-9A-F]+);(\w+) +# (\w+)") + single = re.compile(r"^([0-9A-F]+)\s+;\s+(\w+) +# (\w+)") # matches a width assignment for a range of codepoints, i.e. "3001..3003;W # ..." - multiple = re.compile(r"^([0-9A-F]+)\.\.([0-9A-F]+);(\w+) +# (\w+)") + multiple = re.compile(r"^([0-9A-F]+)\.\.([0-9A-F]+)\s+;\s+(\w+) +# (\w+)") # map between width category code and condensed width width_codes = { **{c: EffectiveWidth.NARROW for c in ["N", "Na", "H"]}, @@ -59,8 +59,6 @@ extern crate test; use tables::charwidth as cw; pub use tables::UNICODE_VERSION; -use core::ops::Add; - mod tables; #[cfg(test)] @@ -121,11 +119,11 @@ pub trait UnicodeWidthStr { impl UnicodeWidthStr for str { #[inline] fn width(&self) -> usize { - 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() } #[inline] fn width_cjk(&self) -> usize { - 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() } } diff --git a/src/tables.rs b/src/tables.rs index 439c69c..791d7a8 100644 --- a/src/tables.rs +++ b/src/tables.rs @@ -12,7 +12,7 @@ /// The version of [Unicode](http://www.unicode.org/) /// that this version of unicode-width is based on. -pub const UNICODE_VERSION: (u8, u8, u8) = (15, 0, 0); +pub const UNICODE_VERSION: (u8, u8, u8) = (15, 1, 0); pub mod charwidth { use core::option::Option::{self, None, Some}; @@ -395,13 +395,13 @@ pub mod charwidth { 0x00, 0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x9A, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x5A, 0x55, 0x55, 0x55, - 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, + 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x0A, 0xA0, 0xAA, 0xAA, 0xAA, 0x6A, 0xA9, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x6A, 0x81, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0xA9, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xA9, 0xAA, 0xAA, 0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