diff --git a/rust_icu_common/tests/hygiene.rs b/rust_icu_common/tests/hygiene.rs index 756ed310..038f0f20 100644 --- a/rust_icu_common/tests/hygiene.rs +++ b/rust_icu_common/tests/hygiene.rs @@ -1,5 +1,6 @@ #![no_implicit_prelude] +#[allow(dead_code)] struct Type { rep: ::std::ptr::NonNull<::rust_icu_sys::UMessageFormat>, } diff --git a/rust_icu_ucnv/src/utf8.rs b/rust_icu_ucnv/src/utf8.rs index 52e1948b..c5808eb2 100644 --- a/rust_icu_ucnv/src/utf8.rs +++ b/rust_icu_ucnv/src/utf8.rs @@ -125,14 +125,14 @@ impl Converter { self.converter.reset_to_uchars(); self.utf8.reset_from_uchars(); self.pivot_to_source = self.pivot_to.start; - self.pivot_to_target = self.pivot_to_target; + self.pivot_to_target = self.pivot_to.start; } pub fn reset_from_utf8(&mut self) { self.utf8.reset_to_uchars(); self.converter.reset_from_uchars(); self.pivot_from_source = self.pivot_from.start; - self.pivot_from_target = self.pivot_from_target; + self.pivot_from_target = self.pivot_from.start; } pub fn feed_to_utf8(&mut self, dst: &mut [u8], src: &[u8]) -> FeedResult { diff --git a/rust_icu_ucsdet/src/lib.rs b/rust_icu_ucsdet/src/lib.rs index eebdc8e7..a87ef9cd 100644 --- a/rust_icu_ucsdet/src/lib.rs +++ b/rust_icu_ucsdet/src/lib.rs @@ -111,7 +111,7 @@ impl<'detector> CharsetDetector<'detector> { } /// Return the charset that best matches the supplied input data. - pub fn detect(&self) -> Result { + pub fn detect(&self) -> Result, common::Error> { let mut status = sys::UErrorCode::U_ZERO_ERROR; let charset_match = unsafe { versioned_function!(ucsdet_detect)(self.rep.as_ptr(), &mut status) }; @@ -128,7 +128,7 @@ impl<'detector> CharsetDetector<'detector> { /// The results are ordered with the best quality match first. /// /// Returns `&[CharsetMatch]` if no error. - pub fn detect_all(&self) -> Result<&[CharsetMatch], common::Error> { + pub fn detect_all(&self) -> Result<&[CharsetMatch<'_>], common::Error> { let mut status = sys::UErrorCode::U_ZERO_ERROR; let mut len = 0; let charset_match = unsafe { diff --git a/rust_icu_udata/src/lib.rs b/rust_icu_udata/src/lib.rs index 10cb9a65..daab998f 100644 --- a/rust_icu_udata/src/lib.rs +++ b/rust_icu_udata/src/lib.rs @@ -24,6 +24,9 @@ use { #[derive(Debug)] enum Rep { /// The data memory is backed by a user-supplied buffer. + /// The Vec is never read; it exists solely to keep the buffer alive + /// while ICU holds a raw pointer to it via udata_setCommonData. + #[allow(dead_code)] Buffer(Vec), /// The data memory is backed by a resource file. Resource(