1
- #[ allow( unused) ]
1
+ #![ allow( unused) ]
2
+
2
3
use std:: cell:: { Cell , UnsafeCell } ;
3
4
use std:: iter;
4
- #[ allow( unused) ]
5
- use std:: sync:: { Arc , Mutex , RwLock , RwLockReadGuard , RwLockWriteGuard , TryLockError } ;
6
- #[ allow( unused) ]
5
+ use std:: sync:: atomic:: { AtomicBool , Ordering } ;
6
+ use std:: sync:: { Arc , Mutex , RwLock , TryLockError } ;
7
7
use std:: thread;
8
8
use std:: time:: Duration ;
9
9
10
10
#[ cfg( feature = "with_client_implementation" ) ]
11
11
use fragile:: SemiSticky ;
12
12
13
- #[ allow( unused) ]
14
- use std:: sync:: atomic:: { AtomicBool , Ordering } ;
15
-
16
13
#[ cfg( feature = "with_client_implementation" ) ]
17
14
use client:: Client ;
18
15
use protocol:: { Breadcrumb , Event , Level } ;
19
16
use scope:: { Scope , ScopeGuard } ;
20
-
21
- #[ cfg( feature = "with_client_implementation" ) ]
22
- use utils:: current_thread;
23
-
24
17
#[ cfg( feature = "with_client_implementation" ) ]
25
18
use scope:: { Stack , StackLayerToken } ;
19
+ #[ cfg( feature = "with_client_implementation" ) ]
20
+ use utils:: current_thread;
26
21
27
22
use uuid:: Uuid ;
28
23
@@ -53,7 +48,7 @@ impl IntoBreadcrumbs for Breadcrumb {
53
48
type Output = iter:: Once < Breadcrumb > ;
54
49
55
50
fn into_breadcrumbs ( self ) -> Self :: Output {
56
- return iter:: once ( self ) ;
51
+ iter:: once ( self )
57
52
}
58
53
}
59
54
@@ -94,6 +89,7 @@ pub(crate) enum PendingProcessor {
94
89
95
90
#[ cfg( feature = "with_client_implementation" ) ]
96
91
impl < F : ' static + FnOnce ( ) -> Box < Fn ( & mut Event ) + Send + Sync > > EventProcessorFactoryFn for F {
92
+ #[ cfg_attr( feature = "cargo-clippy" , allow( boxed_local) ) ]
97
93
fn call ( self : Box < Self > ) -> Box < Fn ( & mut Event ) + Send + Sync > {
98
94
let this: Self = * self ;
99
95
this ( )
@@ -254,7 +250,6 @@ impl Hub {
254
250
/// This is useful for integrations that want to do efficiently nothing if there is no
255
251
/// client bound. Additionally this internally ensures that the client can be safely
256
252
/// synchronized. This prevents accidental recursive calls into the client.
257
- #[ allow( unused_variables) ]
258
253
pub fn with_active < F , R > ( f : F ) -> R
259
254
where
260
255
F : FnOnce ( & Arc < Hub > ) -> R ,
@@ -273,6 +268,7 @@ impl Hub {
273
268
274
269
/// Binds a hub to the current thread for the duration of the call.
275
270
#[ cfg( feature = "with_client_implementation" ) ]
271
+ #[ cfg_attr( feature = "cargo-clippy" , allow( needless_pass_by_value) ) ]
276
272
pub fn run < F : FnOnce ( ) -> R , R > ( hub : Arc < Hub > , f : F ) -> R {
277
273
hub. flush_pending_processors ( ) ;
278
274
let mut restore_process_hub = false ;
@@ -305,7 +301,7 @@ impl Hub {
305
301
// this is for the case where we just switched the hub. This
306
302
// means we need to catch the panic, restore the
307
303
// old context and resume the panic if needed.
308
- let rv = panic:: catch_unwind ( panic:: AssertUnwindSafe ( || f ( ) ) ) ;
304
+ let rv = panic:: catch_unwind ( panic:: AssertUnwindSafe ( f ) ) ;
309
305
THREAD_HUB . with ( |ctx| unsafe { * ctx. get ( ) = old_hub } ) ;
310
306
if restore_process_hub {
311
307
USE_PROCESS_HUB . with ( |x| x. set ( true ) ) ;
@@ -321,7 +317,6 @@ impl Hub {
321
317
/// Sends the event to the current client with the current scope.
322
318
///
323
319
/// In case no client is bound this does nothing instead.
324
- #[ allow( unused_variables) ]
325
320
pub fn capture_event ( & self , event : Event < ' static > ) -> Uuid {
326
321
self . flush_pending_processors ( ) ;
327
322
with_client_impl ! { {
@@ -337,7 +332,6 @@ impl Hub {
337
332
}
338
333
339
334
/// Captures an arbitrary message.
340
- #[ allow( unused_variables) ]
341
335
pub fn capture_message ( & self , msg : & str , level : Level ) -> Uuid {
342
336
self . flush_pending_processors ( ) ;
343
337
with_client_impl ! { {
@@ -364,7 +358,6 @@ impl Hub {
364
358
}
365
359
366
360
/// Drains the currently pending events.
367
- #[ allow( unused_variables) ]
368
361
pub fn drain_events ( & self , timeout : Option < Duration > ) {
369
362
with_client_impl ! { {
370
363
if let Some ( ref client) = self . client( ) {
@@ -407,7 +400,6 @@ impl Hub {
407
400
}
408
401
409
402
/// Invokes a function that can modify the current scope.
410
- #[ allow( unused_variables) ]
411
403
pub fn configure_scope < F , R > ( & self , f : F ) -> R
412
404
where
413
405
R : Default ,
@@ -428,7 +420,6 @@ impl Hub {
428
420
///
429
421
/// This is equivalent to the global [`sentry::add_breadcrumb`](fn.add_breadcrumb.html) but
430
422
/// sends the breadcrumb into the hub instead.
431
- #[ allow( unused_variables) ]
432
423
pub fn add_breadcrumb < B : IntoBreadcrumbs > ( & self , breadcrumb : B ) {
433
424
with_client_impl ! { {
434
425
self . inner. with_mut( |stack| {
@@ -522,7 +513,7 @@ impl Hub {
522
513
self . inner. has_pending_processors. store( any_left, Ordering :: Release ) ;
523
514
if !new_processors. is_empty( ) {
524
515
self . configure_scope( |scope| {
525
- for func in new_processors. into_iter ( ) {
516
+ for func in new_processors {
526
517
scope. event_processors = scope. event_processors. push_back( func) ;
527
518
}
528
519
} ) ;
0 commit comments