diff --git a/allocative/allocative/src/rc_str.rs b/allocative/allocative/src/rc_str.rs index 26f3aa253..be9fb5db0 100644 --- a/allocative/allocative/src/rc_str.rs +++ b/allocative/allocative/src/rc_str.rs @@ -14,6 +14,7 @@ use std::ops::Deref; use std::rc::Rc; #[derive(Clone, Debug, PartialEq, Eq, Ord, PartialOrd)] +#[allow(dead_code)] pub(crate) struct RcStr(Rc); impl<'a> From<&'a str> for RcStr { diff --git a/gazebo/dupe/src/__macro_refs.rs b/gazebo/dupe/src/__macro_refs.rs index 69713c3d6..8fe16b63e 100644 --- a/gazebo/dupe/src/__macro_refs.rs +++ b/gazebo/dupe/src/__macro_refs.rs @@ -12,4 +12,4 @@ use crate::Dupe; #[inline] -pub const fn assert_dupe() {} +pub const fn assert_dupe() {} diff --git a/starlark/src/tests/derive/freeze/basic.rs b/starlark/src/tests/derive/freeze/basic.rs index df4c2e3c2..b2b9a908a 100644 --- a/starlark/src/tests/derive/freeze/basic.rs +++ b/starlark/src/tests/derive/freeze/basic.rs @@ -19,4 +19,5 @@ use crate as starlark; use crate::values::Freeze; #[derive(Freeze)] +#[allow(dead_code)] struct TestUnitStruct; diff --git a/starlark/src/tests/uncategorized.rs b/starlark/src/tests/uncategorized.rs index ecad64568..83336029d 100644 --- a/starlark/src/tests/uncategorized.rs +++ b/starlark/src/tests/uncategorized.rs @@ -956,7 +956,7 @@ fn test_fuzzer_59102() { let res: Result = AstModule::parse("hello_world.star", src.to_owned(), &Dialect::Standard); // The panic actually only happens when we format the result - format!("{:?}", res); + let _unused = format!("{:?}", res); } #[test] @@ -966,7 +966,7 @@ fn test_fuzzer_59371() { let res: Result = AstModule::parse("hello_world.star", src.to_owned(), &Dialect::Standard); // The panic actually only happens when we format the result - format!("{:?}", res); + let _unused = format!("{:?}", res); } #[test] diff --git a/starlark/src/values/error.rs b/starlark/src/values/error.rs index 35ae7ee32..9b5828e14 100644 --- a/starlark/src/values/error.rs +++ b/starlark/src/values/error.rs @@ -100,10 +100,7 @@ impl ValueError { /// Helper to create an [`OperationNotSupported`](ValueError::OperationNotSupported) error. #[cold] - pub fn unsupported<'v, T, V: StarlarkValue<'v> + ?Sized>( - _left: &V, - op: &str, - ) -> crate::Result { + pub fn unsupported<'v, T, V: StarlarkValue<'v>>(_left: &V, op: &str) -> crate::Result { Self::unsupported_owned(V::TYPE, op, None) } @@ -114,7 +111,7 @@ impl ValueError { /// Helper to create an [`OperationNotSupported`](ValueError::OperationNotSupportedBinary) error. #[cold] - pub fn unsupported_with<'v, T, V: StarlarkValue<'v> + ?Sized>( + pub fn unsupported_with<'v, T, V: StarlarkValue<'v>>( _left: &V, op: &str, right: Value, diff --git a/starlark/src/values/layout/vtable.rs b/starlark/src/values/layout/vtable.rs index e43cc85dd..227ee0957 100644 --- a/starlark/src/values/layout/vtable.rs +++ b/starlark/src/values/layout/vtable.rs @@ -134,9 +134,9 @@ pub(crate) struct AValueVTable { allocative: unsafe fn(StarlarkValueRawPtr) -> *const dyn Allocative, } -struct GetTypeId<'v, T: StarlarkValue<'v> + ?Sized>(PhantomData<&'v T>); +struct GetTypeId<'v, T: StarlarkValue<'v>>(PhantomData<&'v T>); -impl<'v, T: StarlarkValue<'v> + ?Sized> GetTypeId<'v, T> { +impl<'v, T: StarlarkValue<'v>> GetTypeId<'v, T> { const TYPE_ID: ConstTypeId = ConstTypeId::of::<::StaticType>(); const STARLARK_TYPE_ID: StarlarkTypeId = StarlarkTypeId::of::(); } diff --git a/starlark/src/values/type_repr.rs b/starlark/src/values/type_repr.rs index 5cb3fbf01..f11b16618 100644 --- a/starlark/src/values/type_repr.rs +++ b/starlark/src/values/type_repr.rs @@ -82,7 +82,7 @@ impl StarlarkTypeRepr for SetType { } } -impl<'v, T: StarlarkValue<'v> + ?Sized> StarlarkTypeRepr for T { +impl<'v, T: StarlarkValue<'v>> StarlarkTypeRepr for T { type Canonical = Self; fn starlark_type_repr() -> Ty { diff --git a/starlark/src/values/types/string/methods.rs b/starlark/src/values/types/string/methods.rs index f963ae4c5..55d51c70c 100644 --- a/starlark/src/values/types/string/methods.rs +++ b/starlark/src/values/types/string/methods.rs @@ -1093,7 +1093,7 @@ pub(crate) fn string_methods(builder: &mut MethodsBuilder) { let mut s = this; let mut lines: Vec = Vec::new(); loop { - if let Some(x) = s.find(|x| x == '\n' || x == '\r') { + if let Some(x) = s.find(['\n', '\r']) { let y = x; let x = match s.get(y..y + 2) { Some("\r\n") => y + 2, diff --git a/starlark/src/values/typing/type_compiled/compiled.rs b/starlark/src/values/typing/type_compiled/compiled.rs index 08a6c7d33..f6cb1b55a 100644 --- a/starlark/src/values/typing/type_compiled/compiled.rs +++ b/starlark/src/values/typing/type_compiled/compiled.rs @@ -350,13 +350,10 @@ impl<'v, V: ValueLike<'v>> Hash for TypeCompiled { impl<'v, V: ValueLike<'v>> PartialEq for TypeCompiled { #[allow(clippy::manual_unwrap_or)] fn eq(&self, other: &Self) -> bool { - match self.0.to_value().equals(other.0.to_value()) { - Ok(b) => b, - Err(_) => { - // Unreachable, but we should not panic in `PartialEq`. - false - } - } + self.0 + .to_value() + .equals(other.0.to_value()) + .unwrap_or_default() } }