File tree 9 files changed +30
-28
lines changed
relay-event-normalization/src/normalize/span
relay-event-schema/src/processor
relay-server/src/services
9 files changed +30
-28
lines changed Original file line number Diff line number Diff line change @@ -60,8 +60,8 @@ pub fn normalize_parsed_queries(
60
60
string : & str ,
61
61
) -> Result < ( String , Vec < Statement > ) , ( ) > {
62
62
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 ( ) ) ;
65
65
66
66
let concatenated = parsed
67
67
. iter ( )
Original file line number Diff line number Diff line change @@ -1322,7 +1322,7 @@ fn sql_tables_from_query(
1322
1322
let mut visitor = SqlTableNameVisitor {
1323
1323
table_names : Default :: default ( ) ,
1324
1324
} ;
1325
- ast. visit ( & mut visitor) ;
1325
+ let _ = ast. visit ( & mut visitor) ;
1326
1326
let comma_size: usize = 1 ;
1327
1327
let mut s = String :: with_capacity (
1328
1328
visitor
Original file line number Diff line number Diff line change @@ -463,6 +463,10 @@ impl<'a> ProcessingState<'a> {
463
463
///
464
464
/// - Returns `Ok(None)` if the current state is the root.
465
465
/// - 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
+ ) ]
466
470
pub fn try_into_parent ( self ) -> Result < Option < Self > , Self > {
467
471
match self . parent {
468
472
Some ( BoxCow :: Borrowed ( _) ) => Err ( self ) ,
Original file line number Diff line number Diff line change @@ -34,9 +34,7 @@ impl NumbersGenerator {
34
34
35
35
fn next ( & self ) -> usize {
36
36
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)
40
38
}
41
39
}
42
40
Original file line number Diff line number Diff line change @@ -729,11 +729,10 @@ where
729
729
return self . inner . visit_borrowed_str ( v) ;
730
730
} ;
731
731
732
- let res = match self . transformer . transform_str ( v) {
732
+ match self . transformer . transform_str ( v) {
733
733
Cow :: Borrowed ( v) => self . inner . visit_borrowed_str ( v) ,
734
734
Cow :: Owned ( v) => self . inner . visit_string ( v) ,
735
- } ;
736
- res
735
+ }
737
736
}
738
737
739
738
fn visit_str < E > ( self , v : & str ) -> Result < Self :: Value , E >
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ impl ItemScoping {
146
146
// skip `Unknown` categories silently. If the list of categories only contains `Unknown`s,
147
147
// we do **not** match, since apparently the quota is meant for some data this Relay does
148
148
// not support yet.
149
- categories. is_empty ( ) || categories. iter ( ) . any ( |cat| * cat == self . category )
149
+ categories. is_empty ( ) || categories. contains ( & self . category )
150
150
}
151
151
152
152
/// Returns `true` if the rate limit namespace matches the namespace of the item.
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ impl GlobalLimiter for GlobalRateLimitsServiceHandle {
67
67
quantity,
68
68
} )
69
69
. await
70
- . map_err ( |_| RateLimitingError :: UnreachableGlobalRateLimits ) ?;
70
+ . map_err ( |_| RateLimitingError :: UnreachableGlobalRateLimits ) ?? ;
71
71
72
72
// Perform a reverse lookup to match each owned quota with its original reference.
73
73
// If multiple identical quotas exist, the first match will be reused. Equality is determined
@@ -80,18 +80,15 @@ impl GlobalLimiter for GlobalRateLimitsServiceHandle {
80
80
//
81
81
// The operation has a time complexity of O(n^2), but the number of quotas is assumed
82
82
// 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)
95
92
}
96
93
}
97
94
Original file line number Diff line number Diff line change @@ -526,7 +526,7 @@ pub enum ProcessingError {
526
526
PiiConfigError ( PiiConfigError ) ,
527
527
528
528
#[ error( "invalid processing group type" ) ]
529
- InvalidProcessingGroup ( # [ from ] InvalidProcessingGroupType ) ,
529
+ InvalidProcessingGroup ( Box < InvalidProcessingGroupType > ) ,
530
530
531
531
#[ error( "invalid replay" ) ]
532
532
InvalidReplay ( DiscardReason ) ,
@@ -620,6 +620,12 @@ impl From<ExtractMetricsError> for ProcessingError {
620
620
}
621
621
}
622
622
623
+ impl From < InvalidProcessingGroupType > for ProcessingError {
624
+ fn from ( value : InvalidProcessingGroupType ) -> Self {
625
+ Self :: InvalidProcessingGroup ( Box :: new ( value) )
626
+ }
627
+ }
628
+
623
629
type ExtractedEvent = ( Annotated < Event > , usize ) ;
624
630
625
631
/// A container for extracted metrics during processing.
Original file line number Diff line number Diff line change @@ -203,10 +203,8 @@ fn get_zstd_dictionary(id: usize) -> Option<&'static zstd::dict::DecoderDictiona
203
203
}
204
204
205
205
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" ) ) ?;
210
208
211
209
let mut decompressor = ZstdDecompressor :: with_prepared_dictionary ( dictionary) ?;
212
210
decompressor. decompress ( data. as_ref ( ) , MAX_DECOMPRESSED_SIZE )
You can’t perform that action at this time.
0 commit comments