4949
5050// {{{ Imports & meta
5151#![ warn( missing_docs) ]
52-
53- #[ macro_use]
54- extern crate slog;
55- extern crate crossbeam_channel;
56- extern crate take_mut;
57- extern crate thread_local;
52+ #![ warn(
53+ rust_2018_idioms,
54+ rust_2018_compatibility,
55+ rust_2021_compatibility,
56+ future_incompatible
57+ ) ]
58+ #![ allow(
59+ // covered by mismatched_lifetime_syntaxes
60+ elided_lifetimes_in_paths,
61+ ) ]
5862
5963use crossbeam_channel:: Sender ;
6064
65+ use slog:: Drain ;
66+ use slog:: { b, o, record} ;
6167use slog:: { BorrowedKV , Level , Record , RecordStatic , SingleKV , KV } ;
6268use slog:: { Key , OwnedKVList , Serializer } ;
6369
64- use slog:: Drain ;
6570use std:: fmt;
6671use std:: sync;
6772use std:: { io, thread} ;
@@ -182,7 +187,7 @@ impl Serializer for ToSendSerializer {
182187 fn emit_serde (
183188 & mut self ,
184189 key : Key ,
185- value : & slog:: SerdeValue ,
190+ value : & dyn slog:: SerdeValue ,
186191 ) -> slog:: Result {
187192 let val = value. to_sendable ( ) ;
188193 take ( & mut self . kv , |kv| Box :: new ( ( kv, SingleKV ( key, val) ) ) ) ;
@@ -441,7 +446,7 @@ impl AsyncCore {
441446 ) -> Result <
442447 & crossbeam_channel:: Sender < AsyncMsg > ,
443448 std:: sync:: PoisonError <
444- sync:: MutexGuard < crossbeam_channel:: Sender < AsyncMsg > > ,
449+ sync:: MutexGuard < ' _ , crossbeam_channel:: Sender < AsyncMsg > > ,
445450 > ,
446451 > {
447452 self . tl_sender . get_or_try ( || Ok ( self . ref_sender . clone ( ) ) )
@@ -506,7 +511,7 @@ impl AsyncRecord {
506511 /// Writes the record to a `Drain`.
507512 pub fn log_to < D : Drain > ( self , drain : & D ) -> Result < D :: Ok , D :: Err > {
508513 let rs = RecordStatic {
509- location : & * self . location ,
514+ location : & self . location ,
510515 level : self . level ,
511516 tag : & self . tag ,
512517 } ;
@@ -524,7 +529,7 @@ impl AsyncRecord {
524529 /// Deconstruct this `AsyncRecord` into a record and `OwnedKVList`.
525530 pub fn as_record_values ( & self , mut f : impl FnMut ( & Record , & OwnedKVList ) ) {
526531 let rs = RecordStatic {
527- location : & * self . location ,
532+ location : & self . location ,
528533 level : self . level ,
529534 tag : & self . tag ,
530535 } ;
@@ -580,6 +585,7 @@ impl Drop for AsyncCore {
580585///
581586/// More variants may be added in the future, without considering it a breaking change.
582587#[ derive( Copy , Clone , Debug , Eq , PartialEq , Hash , Ord , PartialOrd ) ]
588+ #[ non_exhaustive]
583589pub enum OverflowStrategy {
584590 /// The message gets dropped and a message with number of dropped is produced once there's
585591 /// space.
@@ -593,8 +599,6 @@ pub enum OverflowStrategy {
593599 Drop ,
594600 /// The caller is blocked until there's enough space.
595601 Block ,
596- #[ doc( hidden) ]
597- DoNotMatchAgainstThisAndReadTheDocs ,
598602}
599603
600604/// `Async` builder
@@ -636,9 +640,6 @@ where
636640 OverflowStrategy :: Block => ( true , false ) ,
637641 OverflowStrategy :: Drop => ( false , false ) ,
638642 OverflowStrategy :: DropAndReport => ( false , true ) ,
639- OverflowStrategy :: DoNotMatchAgainstThisAndReadTheDocs => {
640- panic ! ( "Invalid variant" )
641- }
642643 } ;
643644 AsyncBuilder {
644645 core : self . core . blocking ( block) ,
@@ -737,6 +738,7 @@ impl Async {
737738 /// The wrapped drain must handle all results (`Drain<Ok=(),Error=Never>`)
738739 /// since there's no way to return it back. See `slog::DrainExt::fuse()` and
739740 /// `slog::DrainExt::ignore_res()` for typical error handling strategies.
741+ #[ allow( clippy:: new_ret_no_self) ] // would break compat
740742 pub fn new < D : slog:: Drain < Err = slog:: Never , Ok = ( ) > + Send + ' static > (
741743 drain : D ,
742744 ) -> AsyncBuilder < D > {
@@ -807,6 +809,7 @@ impl Drop for Async {
807809#[ cfg( test) ]
808810mod test {
809811 use super :: * ;
812+ use slog:: { info, warn} ;
810813 use std:: sync:: mpsc;
811814
812815 #[ test]
0 commit comments