From 9835e2ae736235810b4ea1c162ca5e65c547e770 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 04:49:50 +0200 Subject: Merging upstream version 1.71.1+dfsg1. Signed-off-by: Daniel Baumann --- vendor/icu_locid/src/extensions/mod.rs | 2 +- vendor/icu_locid/src/extensions/unicode/keywords.rs | 14 +++++++------- vendor/icu_locid/src/extensions/unicode/value.rs | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'vendor/icu_locid/src/extensions') diff --git a/vendor/icu_locid/src/extensions/mod.rs b/vendor/icu_locid/src/extensions/mod.rs index a6a189b11..5f1ad2b1f 100644 --- a/vendor/icu_locid/src/extensions/mod.rs +++ b/vendor/icu_locid/src/extensions/mod.rs @@ -214,7 +214,7 @@ impl Extensions { if subtag.is_empty() { return Err(ParserError::InvalidExtension); } - match subtag.get(0).map(|b| ExtensionType::try_from_byte(*b)) { + match subtag.first().map(|b| ExtensionType::try_from_byte(*b)) { Some(Ok(ExtensionType::Unicode)) => { if unicode.is_some() { return Err(ParserError::DuplicatedExtension); diff --git a/vendor/icu_locid/src/extensions/unicode/keywords.rs b/vendor/icu_locid/src/extensions/unicode/keywords.rs index 580cacaf1..4e2fbae9a 100644 --- a/vendor/icu_locid/src/extensions/unicode/keywords.rs +++ b/vendor/icu_locid/src/extensions/unicode/keywords.rs @@ -9,7 +9,7 @@ use litemap::LiteMap; use super::Key; use super::Value; -use crate::helpers::ShortVec; +use crate::helpers::ShortSlice; use crate::ordering::SubtagOrderingResult; /// A list of [`Key`]-[`Value`] pairs representing functional information @@ -66,7 +66,7 @@ use crate::ordering::SubtagOrderingResult; /// /// [`Locale`]: crate::Locale #[derive(Clone, PartialEq, Eq, Debug, Default, Hash, PartialOrd, Ord)] -pub struct Keywords(LiteMap>); +pub struct Keywords(LiteMap>); impl Keywords { /// Returns a new empty list of key-value pairs. Same as [`default()`](Default::default()), but is `const`. @@ -86,9 +86,9 @@ impl Keywords { /// Create a new list of key-value pairs having exactly one pair, callable in a `const` context. #[inline] pub const fn new_single(key: Key, value: Value) -> Self { - Self(LiteMap::from_sorted_store_unchecked(ShortVec::new_single( - (key, value), - ))) + Self(LiteMap::from_sorted_store_unchecked( + ShortSlice::new_single((key, value)), + )) } /// Returns `true` if there are no keywords. @@ -390,8 +390,8 @@ impl Keywords { } } -impl From>> for Keywords { - fn from(map: LiteMap>) -> Self { +impl From>> for Keywords { + fn from(map: LiteMap>) -> Self { Self(map) } } diff --git a/vendor/icu_locid/src/extensions/unicode/value.rs b/vendor/icu_locid/src/extensions/unicode/value.rs index e6374372c..f1b2402de 100644 --- a/vendor/icu_locid/src/extensions/unicode/value.rs +++ b/vendor/icu_locid/src/extensions/unicode/value.rs @@ -2,7 +2,7 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::helpers::ShortVec; +use crate::helpers::ShortSlice; use crate::parser::{ParserError, SubtagIterator}; use alloc::vec::Vec; use core::ops::RangeInclusive; @@ -35,7 +35,7 @@ use tinystr::TinyAsciiStr; /// assert_eq!(value!("true").to_string(), ""); /// ``` #[derive(Debug, PartialEq, Eq, Clone, Hash, PartialOrd, Ord, Default)] -pub struct Value(ShortVec>); +pub struct Value(ShortSlice>); const VALUE_LENGTH: RangeInclusive = 3..=8; const TRUE_VALUE: TinyAsciiStr<8> = tinystr::tinystr!(8, "true"); @@ -52,7 +52,7 @@ impl Value { /// Value::try_from_bytes(b"buddhist").expect("Parsing failed."); /// ``` pub fn try_from_bytes(input: &[u8]) -> Result { - let mut v = ShortVec::new(); + let mut v = Vec::new(); if !input.is_empty() { for subtag in SubtagIterator::new(input) { @@ -62,7 +62,7 @@ impl Value { } } } - Ok(Self(v)) + Ok(Self(v.into())) } /// Const constructor for when the value contains only a single subtag. @@ -96,11 +96,11 @@ impl Value { #[doc(hidden)] pub const fn from_tinystr(subtag: Option>) -> Self { match subtag { - None => Self(ShortVec::new()), + None => Self(ShortSlice::new()), Some(val) => { debug_assert!(val.is_ascii_alphanumeric()); debug_assert!(!matches!(val, TRUE_VALUE)); - Self(ShortVec::new_single(val)) + Self(ShortSlice::new_single(val)) } } } -- cgit v1.2.3