diff --git a/gazebo/gazebo/src/ext/str.rs b/gazebo/gazebo/src/ext/str.rs index 466694aec..1408830ee 100644 --- a/gazebo/gazebo/src/ext/str.rs +++ b/gazebo/gazebo/src/ext/str.rs @@ -28,7 +28,7 @@ pub trait StrExt { #[cfg(feature = "str_pattern_extensions")] fn split1<'a, P>(&'a self, pat: P) -> (&'a Self, &'a Self) where - P: Pattern; + P: Pattern<'a>; /// Like `split`, but only separates off the first element if there is a /// separator, otherwise returns `None`. For example: @@ -48,7 +48,7 @@ pub trait StrExt { #[deprecated(since = "0.6.1", note = "use `split_once` available in `std`")] fn split1_opt<'a, P>(&'a self, pat: P) -> Option<(&'a Self, &'a Self)> where - P: Pattern; + P: Pattern<'a>; /// Trim off the first match, or return the string unchanged if the pattern /// is not a prefix of the string. Like 'trim_start_matches', but at @@ -63,7 +63,7 @@ pub trait StrExt { #[cfg(feature = "str_pattern_extensions")] fn trim_start_match<'a, P>(&'a self, pat: P) -> &'a Self where - P: Pattern; + P: Pattern<'a>; /// Trim off the first match and return 'Some', or return 'None' if the /// pattern is not a prefix of the string. Like 'trim_start_matches'. @@ -79,7 +79,7 @@ pub trait StrExt { #[deprecated(note = "Use str.strip_prefix instead")] fn trim_start_match_opt<'a, P>(&'a self, pat: P) -> Option<&'a Self> where - P: Pattern; + P: Pattern<'a>; /// Trim off the first match, or return the string unchanged if the pattern /// is not a prefix of the string. Like 'trim_start_matches', but at @@ -94,7 +94,7 @@ pub trait StrExt { #[cfg(feature = "str_pattern_extensions")] fn trim_end_match<'a, P>(&'a self, pat: P) -> &'a Self where - P: Pattern: ReverseSearcher<'a>>; + P: Pattern<'a, Searcher: ReverseSearcher<'a>>; /// Trim off the first match and return 'Some', or return 'None' if the /// pattern is not a prefix of the string. Like 'trim_start_matches'. @@ -110,14 +110,14 @@ pub trait StrExt { #[deprecated(note = "Use str.strip_suffix instead")] fn trim_end_match_opt<'a, P>(&'a self, pat: P) -> Option<&'a Self> where - P: Pattern: ReverseSearcher<'a>>; + P: Pattern<'a, Searcher: ReverseSearcher<'a>>; } impl StrExt for str { #[cfg(feature = "str_pattern_extensions")] fn split1_opt<'a, P>(&'a self, pat: P) -> Option<(&'a Self, &'a Self)> where - P: Pattern, + P: Pattern<'a>, { self.split_once(pat) } @@ -125,7 +125,7 @@ impl StrExt for str { #[cfg(feature = "str_pattern_extensions")] fn split1<'a, P>(&'a self, pat: P) -> (&'a Self, &'a Self) where - P: Pattern, + P: Pattern<'a>, { self.split_once(pat).unwrap_or((self, "")) } @@ -133,7 +133,7 @@ impl StrExt for str { #[cfg(feature = "str_pattern_extensions")] fn trim_start_match_opt<'a, P>(&'a self, pat: P) -> Option<&'a Self> where - P: Pattern, + P: Pattern<'a>, { let mut matcher = pat.into_searcher(self); match matcher.next() { @@ -145,7 +145,7 @@ impl StrExt for str { #[cfg(feature = "str_pattern_extensions")] fn trim_start_match<'a, P>(&'a self, pat: P) -> &'a Self where - P: Pattern, + P: Pattern<'a>, { #[allow(deprecated)] self.trim_start_match_opt(pat).unwrap_or(self) @@ -154,7 +154,7 @@ impl StrExt for str { #[cfg(feature = "str_pattern_extensions")] fn trim_end_match_opt<'a, P>(&'a self, pat: P) -> Option<&'a Self> where - P: Pattern: ReverseSearcher<'a>>, + P: Pattern<'a, Searcher: ReverseSearcher<'a>>, { let mut matcher = pat.into_searcher(self); match matcher.next_back() { @@ -166,7 +166,7 @@ impl StrExt for str { #[cfg(feature = "str_pattern_extensions")] fn trim_end_match<'a, P>(&'a self, pat: P) -> &'a Self where - P: Pattern: ReverseSearcher<'a>>, + P: Pattern<'a, Searcher: ReverseSearcher<'a>>, { #[allow(deprecated)] self.trim_end_match_opt(pat).unwrap_or(self) diff --git a/gazebo/gazebo/src/lib.rs b/gazebo/gazebo/src/lib.rs index 626ca4eb0..46368d40c 100644 --- a/gazebo/gazebo/src/lib.rs +++ b/gazebo/gazebo/src/lib.rs @@ -8,7 +8,6 @@ */ #![cfg_attr(feature = "str_pattern_extensions", feature(pattern))] -#![allow(clippy::too_long_first_doc_paragraph)] //! A collection of well-tested primitives that have been useful. Most modules stand alone. diff --git a/starlark/src/values/layout/heap/heap_type.rs b/starlark/src/values/layout/heap/heap_type.rs index ff77a9a25..1595bc191 100644 --- a/starlark/src/values/layout/heap/heap_type.rs +++ b/starlark/src/values/layout/heap/heap_type.rs @@ -786,8 +786,12 @@ impl Heap { &'v self, elems: impl IntoIterator>, ) -> Value<'v> { - match self.try_alloc_list_iter(elems.into_iter().map(Ok::<_, Infallible>)) { + match self.try_alloc_list_iter(elems.into_iter().map(Ok)) { Ok(value) => value, + Err(e) => { + let e: Infallible = e; + match e {} + } } } diff --git a/starlark/src/values/owned_frozen_ref.rs b/starlark/src/values/owned_frozen_ref.rs index 0b17fc86b..ed50cdafc 100644 --- a/starlark/src/values/owned_frozen_ref.rs +++ b/starlark/src/values/owned_frozen_ref.rs @@ -100,8 +100,12 @@ impl<'f, T: ?Sized> OwnedRefFrozenRef<'f, T> { where F: FnOnce(&'f T) -> &'f U, { - match self.try_map_result(|x| Ok::<_, Infallible>(f(x))) { + match self.try_map_result(|x| Ok(f(x))) { Ok(x) => x, + Err(e) => { + let e: Infallible = e; + match e {} + } } } diff --git a/starlark/src/values/types/list/value.rs b/starlark/src/values/types/list/value.rs index fb9f30081..450a8fdce 100644 --- a/starlark/src/values/types/list/value.rs +++ b/starlark/src/values/types/list/value.rs @@ -184,8 +184,12 @@ impl<'v> ListData<'v> { #[inline] pub(crate) fn extend>>(&self, iter: I, heap: &'v Heap) { - match self.try_extend(iter.into_iter().map(Ok::<_, Infallible>), heap) { + match self.try_extend(iter.into_iter().map(Ok), heap) { Ok(()) => {} + Err(e) => { + let e: Infallible = e; + match e {} + } } } diff --git a/starlark_derive/src/lib.rs b/starlark_derive/src/lib.rs index daae4f44f..14ed5520a 100644 --- a/starlark_derive/src/lib.rs +++ b/starlark_derive/src/lib.rs @@ -181,11 +181,11 @@ pub fn derive_alloc_frozen_value(input: proc_macro::TokenStream) -> proc_macro:: alloc_value::derive_alloc_frozen_value(input) } -/// Derive accessor methods that are designed to be used from {has,get,dir}_attr in an `impl StarlarkValue` block. -/// -/// All fields in the struct that are not marked with #[starlark(skip)] are exported to Starlark code as -/// attributes. NOTE: Any usage must also call `starlark_attrs!()` in the impl block for `StarlarkValue`, -/// otherwise the generated attr methods will not be used. +/// Derive accessor methods that are designed to be used from {has,get,dir}_attr +/// in an `impl StarlarkValue` block. All fields in the struct that are not +/// marked with #[starlark(skip)] are exported to Starlark code as attributes. +/// NOTE: Any usage must also call `starlark_attrs!()` in the impl block for +/// `StarlarkValue`, otherwise the generated attr methods will not be used. #[proc_macro_derive(StarlarkAttrs, attributes(starlark))] pub fn derive_starlark_attrs(input: proc_macro::TokenStream) -> proc_macro::TokenStream { attrs::derive_attrs(input)