File tree Expand file tree Collapse file tree 9 files changed +20
-73
lines changed Expand file tree Collapse file tree 9 files changed +20
-73
lines changed Original file line number Diff line number Diff line change 1212 runs-on : ubuntu-latest
1313 strategy :
1414 matrix :
15- rust : [stable, 1.40 .0]
15+ rust : [stable, 1.42 .0]
1616 steps :
1717 - uses : actions/checkout@main
1818 - uses : actions-rs/toolchain@v1
Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ fn async_fn_with_async_trait_and_fields_expressions_with_generic_parameter() {
223223 async fn call_with_self ( & self ) { }
224224
225225 #[ instrument( fields( Self =std:: any:: type_name:: <Self >( ) ) ) ]
226- async fn call_with_mut_self ( self : & mut Self ) { }
226+ async fn call_with_mut_self ( & mut self ) { }
227227 }
228228
229229 //let span = span::mock().named("call");
Original file line number Diff line number Diff line change @@ -103,10 +103,7 @@ impl<'a> Event<'a> {
103103
104104 /// Returns true if the new event should be a root.
105105 pub fn is_root ( & self ) -> bool {
106- match self . parent {
107- Parent :: Root => true ,
108- _ => false ,
109- }
106+ matches ! ( self . parent, Parent :: Root )
110107 }
111108
112109 /// Returns true if the new event's parent should be determined based on the
@@ -117,10 +114,7 @@ impl<'a> Event<'a> {
117114 /// thread is _not_ inside a span, then the new event will be the root of its
118115 /// own trace tree.
119116 pub fn is_contextual ( & self ) -> bool {
120- match self . parent {
121- Parent :: Current => true ,
122- _ => false ,
123- }
117+ matches ! ( self . parent, Parent :: Current )
124118 }
125119
126120 /// Returns the new event's explicitly-specified parent, if there is one.
Original file line number Diff line number Diff line change @@ -251,18 +251,12 @@ impl Kind {
251251
252252 /// Return true if the callsite kind is `Span`
253253 pub fn is_span ( & self ) -> bool {
254- match self {
255- Kind ( KindInner :: Span ) => true ,
256- _ => false ,
257- }
254+ matches ! ( self , Kind ( KindInner :: Span ) )
258255 }
259256
260257 /// Return true if the callsite kind is `Event`
261258 pub fn is_event ( & self ) -> bool {
262- match self {
263- Kind ( KindInner :: Event ) => true ,
264- _ => false ,
265- }
259+ matches ! ( self , Kind ( KindInner :: Event ) )
266260 }
267261}
268262
@@ -553,8 +547,7 @@ impl FromStr for LevelFilter {
553547 s if s. eq_ignore_ascii_case ( "trace" ) => Some ( LevelFilter :: TRACE ) ,
554548 s if s. eq_ignore_ascii_case ( "off" ) => Some ( LevelFilter :: OFF ) ,
555549 _ => None ,
556- } )
557- . ok_or_else ( || ParseLevelFilterError ( ( ) ) )
550+ } ) . ok_or ( ParseLevelFilterError ( ( ) ) )
558551 }
559552}
560553
Original file line number Diff line number Diff line change @@ -153,10 +153,7 @@ impl<'a> Attributes<'a> {
153153
154154 /// Returns true if the new span should be a root.
155155 pub fn is_root ( & self ) -> bool {
156- match self . parent {
157- Parent :: Root => true ,
158- _ => false ,
159- }
156+ matches ! ( self . parent, Parent :: Root )
160157 }
161158
162159 /// Returns true if the new span's parent should be determined based on the
@@ -167,10 +164,7 @@ impl<'a> Attributes<'a> {
167164 /// thread is _not_ inside a span, then the new span will be the root of its
168165 /// own trace tree.
169166 pub fn is_contextual ( & self ) -> bool {
170- match self . parent {
171- Parent :: Current => true ,
172- _ => false ,
173- }
167+ matches ! ( self . parent, Parent :: Current )
174168 }
175169
176170 /// Returns the new span's explicitly-specified parent, if there is one.
@@ -270,10 +264,7 @@ impl Current {
270264 /// [`metadata`]: #method.metadata
271265 /// [`into_inner`]: #method.into_inner
272266 pub fn is_known ( & self ) -> bool {
273- match self . inner {
274- CurrentInner :: Unknown => false ,
275- _ => true ,
276- }
267+ !matches ! ( self . inner, CurrentInner :: Unknown )
277268 }
278269
279270 /// Consumes `self` and returns the span `Id` and `Metadata` of the current
Original file line number Diff line number Diff line change @@ -528,30 +528,21 @@ impl Interest {
528528 /// about this callsite.
529529 #[ inline]
530530 pub fn is_never ( & self ) -> bool {
531- match self . 0 {
532- InterestKind :: Never => true ,
533- _ => false ,
534- }
531+ matches ! ( self . 0 , InterestKind :: Never )
535532 }
536533
537534 /// Returns `true` if the subscriber is sometimes interested in being notified
538535 /// about this callsite.
539536 #[ inline]
540537 pub fn is_sometimes ( & self ) -> bool {
541- match self . 0 {
542- InterestKind :: Sometimes => true ,
543- _ => false ,
544- }
538+ matches ! ( self . 0 , InterestKind :: Sometimes )
545539 }
546540
547541 /// Returns `true` if the subscriber is always interested in being notified
548542 /// about this callsite.
549543 #[ inline]
550544 pub fn is_always ( & self ) -> bool {
551- match self . 0 {
552- InterestKind :: Always => true ,
553- _ => false ,
554- }
545+ matches ! ( self . 0 , InterestKind :: Always )
555546 }
556547
557548 /// Returns the common interest between these two Interests.
Original file line number Diff line number Diff line change @@ -1052,22 +1052,13 @@ impl FmtSpanConfig {
10521052 }
10531053 }
10541054 pub ( super ) fn trace_new ( & self ) -> bool {
1055- match self . kind {
1056- FmtSpan :: FULL => true ,
1057- _ => false ,
1058- }
1055+ matches ! ( self . kind, FmtSpan :: FULL )
10591056 }
10601057 pub ( super ) fn trace_active ( & self ) -> bool {
1061- match self . kind {
1062- FmtSpan :: ACTIVE | FmtSpan :: FULL => true ,
1063- _ => false ,
1064- }
1058+ matches ! ( self . kind, FmtSpan :: ACTIVE | FmtSpan :: FULL )
10651059 }
10661060 pub ( super ) fn trace_close ( & self ) -> bool {
1067- match self . kind {
1068- FmtSpan :: CLOSE | FmtSpan :: FULL => true ,
1069- _ => false ,
1070- }
1061+ matches ! ( self . kind, FmtSpan :: CLOSE | FmtSpan :: FULL )
10711062 }
10721063}
10731064
Original file line number Diff line number Diff line change @@ -210,19 +210,13 @@ impl Error {
210210 /// Returns `true` if this error occurred because the layer was poisoned by
211211 /// a panic on another thread.
212212 pub fn is_poisoned ( & self ) -> bool {
213- match self . kind {
214- ErrorKind :: Poisoned => true ,
215- _ => false ,
216- }
213+ matches ! ( self . kind, ErrorKind :: Poisoned )
217214 }
218215
219216 /// Returns `true` if this error occurred because the `Subscriber`
220217 /// containing the reloadable layer was dropped.
221218 pub fn is_dropped ( & self ) -> bool {
222- match self . kind {
223- ErrorKind :: SubscriberGone => true ,
224- _ => false ,
225- }
219+ matches ! ( self . kind, ErrorKind :: SubscriberGone )
226220 }
227221}
228222
Original file line number Diff line number Diff line change @@ -213,11 +213,7 @@ where
213213 "[{}] record: {}; id={:?}; values={:?};" ,
214214 self . name, span. name, id, values
215215 ) ;
216- let was_expected = if let Some ( Expect :: Visit ( _, _) ) = expected. front ( ) {
217- true
218- } else {
219- false
220- } ;
216+ let was_expected = matches ! ( expected. front( ) , Some ( Expect :: Visit ( _, _) ) ) ;
221217 if was_expected {
222218 if let Expect :: Visit ( expected_span, mut expected_values) = expected. pop_front ( ) . unwrap ( )
223219 {
@@ -319,10 +315,7 @@ where
319315 id
320316 ) ;
321317 let mut expected = self . expected . lock ( ) . unwrap ( ) ;
322- let was_expected = match expected. front ( ) {
323- Some ( Expect :: NewSpan ( _) ) => true ,
324- _ => false ,
325- } ;
318+ let was_expected = matches ! ( expected. front( ) , Some ( Expect :: NewSpan ( _) ) ) ;
326319 let mut spans = self . spans . lock ( ) . unwrap ( ) ;
327320 if was_expected {
328321 if let Expect :: NewSpan ( mut expected) = expected. pop_front ( ) . unwrap ( ) {
You can’t perform that action at this time.
0 commit comments