diff --git a/Cargo.toml b/Cargo.toml index 3bc0d33..420047f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ repository = "https://github.com/tormol/encode_unicode" documentation = "https://docs.rs/encode_unicode/" authors = ["Torbjørn Birch Moltu "] edition = "2021" +include = ["Cargo.toml", "README.md", "LICENSE-MIT", "LICENSE-APACHE", "src/**/*.rs", "RELEASES.md", "AUTHORS.md"] [dependencies.ascii] optional = true diff --git a/src/decoding_iterators.rs b/src/decoding_iterators.rs index 92bc060..ea51772 100644 --- a/src/decoding_iterators.rs +++ b/src/decoding_iterators.rs @@ -223,7 +223,7 @@ pub struct Utf8CharDecoder<'a> { index: usize, } impl<'a> From<&'a[u8]> for Utf8CharDecoder<'a> { - fn from(s: &[u8]) -> Utf8CharDecoder { + fn from(s: &[u8]) -> Utf8CharDecoder<'_> { Utf8CharDecoder { slice: s, index: 0 } } } diff --git a/src/traits.rs b/src/traits.rs index 53b1211..55c8535 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -605,26 +605,26 @@ fn combine_surrogates(first: u16, second: u16) -> char { /// Adds `.utf8chars()` and `.utf16chars()` iterator constructors to `&str`. pub trait StrExt: AsRef { /// Equivalent to `.chars()` but produces `Utf8Char`s. - fn utf8chars(&self) -> Utf8Chars; + fn utf8chars(&self) -> Utf8Chars<'_>; /// Equivalent to `.chars()` but produces `Utf16Char`s. - fn utf16chars(&self) -> Utf16Chars; + fn utf16chars(&self) -> Utf16Chars<'_>; /// Equivalent to `.char_indices()` but produces `Utf8Char`s. - fn utf8char_indices(&self) -> Utf8CharIndices; + fn utf8char_indices(&self) -> Utf8CharIndices<'_>; /// Equivalent to `.char_indices()` but produces `Utf16Char`s. - fn utf16char_indices(&self) -> Utf16CharIndices; + fn utf16char_indices(&self) -> Utf16CharIndices<'_>; } impl StrExt for str { - fn utf8chars(&self) -> Utf8Chars { + fn utf8chars(&self) -> Utf8Chars<'_> { Utf8Chars::from(self) } - fn utf16chars(&self) -> Utf16Chars { + fn utf16chars(&self) -> Utf16Chars<'_> { Utf16Chars::from(self) } - fn utf8char_indices(&self) -> Utf8CharIndices { + fn utf8char_indices(&self) -> Utf8CharIndices<'_> { Utf8CharIndices::from(self) } - fn utf16char_indices(&self) -> Utf16CharIndices { + fn utf16char_indices(&self) -> Utf16CharIndices<'_> { Utf16CharIndices::from(self) } } @@ -938,7 +938,7 @@ pub trait SliceExt: Index { /// (11, Utf8ErrorKind::TooFewBytes), // (but it was not the last element returned!) /// ]); /// ``` - fn utf8char_indices(&self) -> Utf8CharDecoder where Self::Output: Borrow<[u8]>; + fn utf8char_indices(&self) -> Utf8CharDecoder<'_> where Self::Output: Borrow<[u8]>; /// Decode `u16` slices as UTF-16 and iterate over the codepoints as `Utf16Char`s, @@ -999,14 +999,14 @@ pub trait SliceExt: Index { /// assert_eq!(iter.next(), None); /// assert_eq!(iter.as_slice(), []) /// ``` - fn utf16char_indices(&self) -> Utf16CharDecoder where Self::Output: Borrow<[u16]>; + fn utf16char_indices(&self) -> Utf16CharDecoder<'_> where Self::Output: Borrow<[u16]>; } impl> SliceExt for S { - fn utf8char_indices(&self) -> Utf8CharDecoder where Self::Output: Borrow<[u8]> { + fn utf8char_indices(&self) -> Utf8CharDecoder<'_> where Self::Output: Borrow<[u8]> { Utf8CharDecoder::from(self[..].borrow()) } - fn utf16char_indices(&self) -> Utf16CharDecoder where Self::Output: Borrow<[u16]> { + fn utf16char_indices(&self) -> Utf16CharDecoder<'_> where Self::Output: Borrow<[u16]> { Utf16CharDecoder::from(self[..].borrow()) } } diff --git a/src/utf16_iterators.rs b/src/utf16_iterators.rs index 30dcd80..42f9006 100644 --- a/src/utf16_iterators.rs +++ b/src/utf16_iterators.rs @@ -155,7 +155,7 @@ pub struct Utf16CharIndices<'a>{ index: usize, } impl<'a> From<&'a str> for Utf16CharIndices<'a> { - fn from(s: &str) -> Utf16CharIndices { + fn from(s: &str) -> Utf16CharIndices<'_> { Utf16CharIndices{str: s, index: 0} } } @@ -222,7 +222,7 @@ impl<'a> fmt::Debug for Utf16CharIndices<'a> { #[derive(Clone)] pub struct Utf16Chars<'a>(Utf16CharIndices<'a>); impl<'a> From<&'a str> for Utf16Chars<'a> { - fn from(s: &str) -> Utf16Chars { + fn from(s: &str) -> Utf16Chars<'_> { Utf16Chars(Utf16CharIndices::from(s)) } } diff --git a/src/utf8_iterators.rs b/src/utf8_iterators.rs index b37c687..b2d4506 100644 --- a/src/utf8_iterators.rs +++ b/src/utf8_iterators.rs @@ -234,7 +234,7 @@ pub struct Utf8CharIndices<'a>{ index: usize, } impl<'a> From<&'a str> for Utf8CharIndices<'a> { - fn from(s: &str) -> Utf8CharIndices { + fn from(s: &str) -> Utf8CharIndices<'_> { Utf8CharIndices{str: s, index: 0} } } @@ -303,7 +303,7 @@ impl<'a> fmt::Debug for Utf8CharIndices<'a> { #[derive(Clone)] pub struct Utf8Chars<'a>(Utf8CharIndices<'a>); impl<'a> From<&'a str> for Utf8Chars<'a> { - fn from(s: &str) -> Utf8Chars { + fn from(s: &str) -> Utf8Chars<'_> { Utf8Chars(Utf8CharIndices::from(s)) } }