Skip to content

Commit

Permalink
ref(relay): Fix Rust 1.83 lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde committed Nov 28, 2024
1 parent b496ef6 commit 4a894d0
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 16 deletions.
1 change: 1 addition & 0 deletions relay-event-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ fn derive_process_value(mut s: synstructure::Structure<'_>) -> TokenStream {

s.gen_impl(quote! {
#[automatically_derived]
#[expect(non_local_definitions, reason = "crate needs to be migrated to syn2")]
gen impl crate::processor::ProcessValue for @Self {
fn value_type(&self) -> enumset::EnumSet<crate::processor::ValueType> {
match *self {
Expand Down
2 changes: 1 addition & 1 deletion relay-event-normalization/src/normalize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl<'a> CombinedMeasurementsConfig<'a> {
/// there are no duplicates.
pub fn builtin_measurement_keys(
&'a self,
) -> impl Iterator<Item = &'a BuiltinMeasurementKey> + '_ {
) -> impl Iterator<Item = &'a BuiltinMeasurementKey> + 'a {
let project = self
.project
.map(|p| p.builtin_measurements.as_slice())
Expand Down
12 changes: 6 additions & 6 deletions relay-event-schema/src/processor/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl<'a> PartialEq for PathItem<'a> {
}
}

impl<'a> PathItem<'a> {
impl PathItem<'_> {
/// Returns the key if there is one
#[inline]
pub fn key(&self) -> Option<&str> {
Expand All @@ -257,7 +257,7 @@ impl<'a> PathItem<'a> {
}
}

impl<'a> fmt::Display for PathItem<'a> {
impl fmt::Display for PathItem<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
PathItem::StaticKey(s) => f.pad(s),
Expand Down Expand Up @@ -517,9 +517,9 @@ impl<'a> Iterator for ProcessingStateIter<'a> {
}
}

impl<'a> ExactSizeIterator for ProcessingStateIter<'a> {}
impl ExactSizeIterator for ProcessingStateIter<'_> {}

impl<'a> Default for ProcessingState<'a> {
impl Default for ProcessingState<'_> {
fn default() -> Self {
ProcessingState::root().clone()
}
Expand All @@ -531,7 +531,7 @@ impl<'a> Default for ProcessingState<'a> {
#[derive(Debug)]
pub struct Path<'a>(&'a ProcessingState<'a>);

impl<'a> Path<'a> {
impl Path<'_> {
/// Returns the current key if there is one
#[inline]
pub fn key(&self) -> Option<&str> {
Expand Down Expand Up @@ -560,7 +560,7 @@ impl<'a> Path<'a> {
}
}

impl<'a> fmt::Display for Path<'a> {
impl fmt::Display for Path<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut items = Vec::with_capacity(self.0.depth);
for state in self.0.iter() {
Expand Down
2 changes: 1 addition & 1 deletion relay-event-schema/src/processor/chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub enum Chunk<'a> {
},
}

impl<'a> Chunk<'a> {
impl Chunk<'_> {
/// The text of this chunk.
pub fn as_str(&self) -> &str {
match self {
Expand Down
2 changes: 1 addition & 1 deletion relay-event-schema/src/protocol/security_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ mod serde_date_time_3339 {
{
struct DateTimeVisitor;

impl<'de> Visitor<'de> for DateTimeVisitor {
impl Visitor<'_> for DateTimeVisitor {
type Value = Option<DateTime<Utc>>;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
4 changes: 2 additions & 2 deletions relay-event-schema/src/protocol/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ where
///
/// The key may be any borrowed form of the pairlist's key type. If there are multiple entries
/// with the same key, the first is returned.
pub fn get<'a, Q>(&'a self, key: Q) -> Option<&Annotated<V>>
pub fn get<'a, Q>(&'a self, key: Q) -> Option<&'a Annotated<V>>
where
Q: AsRef<str>,
K: 'a,
Expand All @@ -200,7 +200,7 @@ where
///
/// The key may be any borrowed form of the pairlist's key type. If there are multiple entries
/// with the same key, the first is returned.
pub fn get_value<'a, Q>(&'a self, key: Q) -> Option<&V>
pub fn get_value<'a, Q>(&'a self, key: Q) -> Option<&'a V>
where
Q: AsRef<str>,
K: 'a,
Expand Down
2 changes: 1 addition & 1 deletion relay-kafka/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl TopicAssignment {
&'a self,
default_config: &'a Vec<KafkaConfigParam>,
secondary_configs: &'a BTreeMap<String, Vec<KafkaConfigParam>>,
) -> Result<KafkaParams<'_>, ConfigError> {
) -> Result<KafkaParams<'a>, ConfigError> {
let kafka_config = match self {
Self::Primary(topic_name) => KafkaParams {
topic_name,
Expand Down
2 changes: 1 addition & 1 deletion relay-pattern/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ pub struct PatternBuilder<'a> {
options: Options,
}

impl<'a> PatternBuilder<'a> {
impl PatternBuilder<'_> {
/// If enabled matches the pattern case insensitive.
///
/// This is disabled by default.
Expand Down
9 changes: 6 additions & 3 deletions relay-pattern/src/wildmatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,13 @@ struct AltAndTokens<'a> {
tokens: &'a [Token],
}

impl<'a> TokenIndex for AltAndTokens<'a> {
impl TokenIndex for AltAndTokens<'_> {
// Type here does not matter, we implement `with_alternate` by returning the never type.
// It just needs to satisfy the `TokenIndex` trait bound.
type WithAlternates<'b> = AltAndTokens<'b> where Self: 'b;
type WithAlternates<'b>
= AltAndTokens<'b>
where
Self: 'b;

#[inline(always)]
fn len(&self) -> usize {
Expand All @@ -434,7 +437,7 @@ impl<'a> TokenIndex for AltAndTokens<'a> {
}
}

impl<'a> std::ops::Index<usize> for AltAndTokens<'a> {
impl std::ops::Index<usize> for AltAndTokens<'_> {
type Output = Token;

fn index(&self, index: usize) -> &Self::Output {
Expand Down
7 changes: 7 additions & 0 deletions relay-protocol-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ fn derive_empty(mut s: synstructure::Structure<'_>) -> TokenStream {

s.gen_impl(quote! {
#[automatically_derived]
#[expect(non_local_definitions, reason = "crate needs to be migrated to syn2")]
gen impl ::relay_protocol::Empty for @Self {
fn is_empty(&self) -> bool {
match *self {
Expand Down Expand Up @@ -139,6 +140,7 @@ fn derive_newtype_metastructure(
Ok(match t {
Trait::From => s.gen_impl(quote! {
#[automatically_derived]
#[expect(non_local_definitions, reason = "crate needs to be migrated to syn2")]
gen impl ::relay_protocol::FromValue for @Self {
fn from_value(
__value: ::relay_protocol::Annotated<::relay_protocol::Value>,
Expand All @@ -152,6 +154,7 @@ fn derive_newtype_metastructure(
}),
Trait::To => s.gen_impl(quote! {
#[automatically_derived]
#[expect(non_local_definitions, reason = "crate needs to be migrated to syn2")]
gen impl ::relay_protocol::IntoValue for @Self {
fn into_value(self) -> ::relay_protocol::Value {
::relay_protocol::IntoValue::into_value(self.0)
Expand Down Expand Up @@ -267,6 +270,7 @@ fn derive_enum_metastructure(
Trait::From => {
s.gen_impl(quote! {
#[automatically_derived]
#[expect(non_local_definitions, reason = "crate needs to be migrated to syn2")]
gen impl ::relay_protocol::FromValue for @Self {
fn from_value(
__value: ::relay_protocol::Annotated<::relay_protocol::Value>,
Expand All @@ -287,6 +291,7 @@ fn derive_enum_metastructure(
Trait::To => {
s.gen_impl(quote! {
#[automatically_derived]
#[expect(non_local_definitions, reason = "crate needs to be migrated to syn2")]
gen impl ::relay_protocol::IntoValue for @Self {
fn into_value(self) -> ::relay_protocol::Value {
match self {
Expand Down Expand Up @@ -490,6 +495,7 @@ fn derive_metastructure(s: synstructure::Structure<'_>, t: Trait) -> TokenStream

s.gen_impl(quote! {
#[automatically_derived]
#[expect(non_local_definitions, reason = "crate needs to be migrated to syn2")]
gen impl ::relay_protocol::FromValue for @Self {
fn from_value(
__value: ::relay_protocol::Annotated<::relay_protocol::Value>,
Expand Down Expand Up @@ -540,6 +546,7 @@ fn derive_metastructure(s: synstructure::Structure<'_>, t: Trait) -> TokenStream

s.gen_impl(quote! {
#[automatically_derived]
#[expect(non_local_definitions, reason = "crate needs to be migrated to syn2")]
gen impl ::relay_protocol::IntoValue for @Self {
fn into_value(self) -> ::relay_protocol::Value {
#into_value
Expand Down

0 comments on commit 4a894d0

Please sign in to comment.