Skip to content

Commit 9e432ed

Browse files
authored
chore: Fix 1.87.0 clippy lints (#4746)
1 parent d16059c commit 9e432ed

File tree

9 files changed

+30
-28
lines changed

9 files changed

+30
-28
lines changed

relay-event-normalization/src/normalize/span/description/sql/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ pub fn normalize_parsed_queries(
6060
string: &str,
6161
) -> Result<(String, Vec<Statement>), ()> {
6262
let mut parsed = parse_query(db_system, string).map_err(|_| ())?;
63-
parsed.visit(&mut NormalizeVisitor);
64-
parsed.visit(&mut MaxDepthVisitor::new());
63+
let _ = parsed.visit(&mut NormalizeVisitor);
64+
let _ = parsed.visit(&mut MaxDepthVisitor::new());
6565

6666
let concatenated = parsed
6767
.iter()

relay-event-normalization/src/normalize/span/tag_extraction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ fn sql_tables_from_query(
13221322
let mut visitor = SqlTableNameVisitor {
13231323
table_names: Default::default(),
13241324
};
1325-
ast.visit(&mut visitor);
1325+
let _ = ast.visit(&mut visitor);
13261326
let comma_size: usize = 1;
13271327
let mut s = String::with_capacity(
13281328
visitor

relay-event-schema/src/processor/attrs.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,10 @@ impl<'a> ProcessingState<'a> {
463463
///
464464
/// - Returns `Ok(None)` if the current state is the root.
465465
/// - Returns `Err(self)` if the current state does not own the parent state.
466+
#[expect(
467+
clippy::result_large_err,
468+
reason = "this method returns `self` in the error case"
469+
)]
466470
pub fn try_into_parent(self) -> Result<Option<Self>, Self> {
467471
match self.parent {
468472
Some(BoxCow::Borrowed(_)) => Err(self),

relay-metrics/benches/benches.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ impl NumbersGenerator {
3434

3535
fn next(&self) -> usize {
3636
let dist = Uniform::new(self.min, self.max + 1);
37-
let value = self.generator.borrow_mut().sample(dist);
38-
39-
value
37+
self.generator.borrow_mut().sample(dist)
4038
}
4139
}
4240

relay-pii/src/transform.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,11 +729,10 @@ where
729729
return self.inner.visit_borrowed_str(v);
730730
};
731731

732-
let res = match self.transformer.transform_str(v) {
732+
match self.transformer.transform_str(v) {
733733
Cow::Borrowed(v) => self.inner.visit_borrowed_str(v),
734734
Cow::Owned(v) => self.inner.visit_string(v),
735-
};
736-
res
735+
}
737736
}
738737

739738
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>

relay-quotas/src/quota.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl ItemScoping {
146146
// skip `Unknown` categories silently. If the list of categories only contains `Unknown`s,
147147
// we do **not** match, since apparently the quota is meant for some data this Relay does
148148
// not support yet.
149-
categories.is_empty() || categories.iter().any(|cat| *cat == self.category)
149+
categories.is_empty() || categories.contains(&self.category)
150150
}
151151

152152
/// Returns `true` if the rate limit namespace matches the namespace of the item.

relay-server/src/services/global_rate_limits.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl GlobalLimiter for GlobalRateLimitsServiceHandle {
6767
quantity,
6868
})
6969
.await
70-
.map_err(|_| RateLimitingError::UnreachableGlobalRateLimits)?;
70+
.map_err(|_| RateLimitingError::UnreachableGlobalRateLimits)??;
7171

7272
// Perform a reverse lookup to match each owned quota with its original reference.
7373
// If multiple identical quotas exist, the first match will be reused. Equality is determined
@@ -80,18 +80,15 @@ impl GlobalLimiter for GlobalRateLimitsServiceHandle {
8080
//
8181
// The operation has a time complexity of O(n^2), but the number of quotas is assumed
8282
// to be small, as they are currently used only for metric bucket limiting.
83-
let rate_limited_global_quotas =
84-
rate_limited_owned_global_quotas.map(|owned_global_quotas| {
85-
owned_global_quotas
86-
.iter()
87-
.filter_map(|owned_global_quota| {
88-
let global_quota = owned_global_quota.build_ref();
89-
global_quotas.iter().find(|x| **x == global_quota)
90-
})
91-
.collect::<Vec<_>>()
92-
});
93-
94-
rate_limited_global_quotas
83+
84+
let res = rate_limited_owned_global_quotas
85+
.iter()
86+
.filter_map(|owned_global_quota| {
87+
let global_quota = owned_global_quota.build_ref();
88+
global_quotas.iter().find(|x| **x == global_quota)
89+
})
90+
.collect::<Vec<_>>();
91+
Ok(res)
9592
}
9693
}
9794

relay-server/src/services/processor.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ pub enum ProcessingError {
526526
PiiConfigError(PiiConfigError),
527527

528528
#[error("invalid processing group type")]
529-
InvalidProcessingGroup(#[from] InvalidProcessingGroupType),
529+
InvalidProcessingGroup(Box<InvalidProcessingGroupType>),
530530

531531
#[error("invalid replay")]
532532
InvalidReplay(DiscardReason),
@@ -620,6 +620,12 @@ impl From<ExtractMetricsError> for ProcessingError {
620620
}
621621
}
622622

623+
impl From<InvalidProcessingGroupType> for ProcessingError {
624+
fn from(value: InvalidProcessingGroupType) -> Self {
625+
Self::InvalidProcessingGroup(Box::new(value))
626+
}
627+
}
628+
623629
type ExtractedEvent = (Annotated<Event>, usize);
624630

625631
/// A container for extracted metrics during processing.

relay-server/src/services/processor/nnswitch.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,8 @@ fn get_zstd_dictionary(id: usize) -> Option<&'static zstd::dict::DecoderDictiona
203203
}
204204

205205
fn decompress_data_zstd(data: Bytes, dictionary_id: u8) -> std::io::Result<Vec<u8>> {
206-
let dictionary = get_zstd_dictionary(dictionary_id as usize).ok_or(std::io::Error::new(
207-
std::io::ErrorKind::Other,
208-
"Unknown compression dictionary",
209-
))?;
206+
let dictionary = get_zstd_dictionary(dictionary_id as usize)
207+
.ok_or(std::io::Error::other("Unknown compression dictionary"))?;
210208

211209
let mut decompressor = ZstdDecompressor::with_prepared_dictionary(dictionary)?;
212210
decompressor.decompress(data.as_ref(), MAX_DECOMPRESSED_SIZE)

0 commit comments

Comments
 (0)