File tree Expand file tree Collapse file tree 9 files changed +30
-28
lines changed
relay-event-normalization/src/normalize/span
relay-event-schema/src/processor
relay-server/src/services Expand file tree Collapse file tree 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(
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 ( )
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ) ,
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 >
Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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+
623629type ExtractedEvent = ( Annotated < Event > , usize ) ;
624630
625631/// 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
203203}
204204
205205fn 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 )
You can’t perform that action at this time.
0 commit comments