Skip to content

Commit

Permalink
[refactor]: remove excessive const generic
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Balashov <[email protected]>
  • Loading branch information
0x009922 committed Dec 12, 2023
1 parent 23bd7e6 commit 4c9bab4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion logger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ where

subscriber.with(console_subscriber)
};
let (subscriber, receiver) = telemetry::Layer::new::<TELEMETRY_CAPACITY>(subscriber);
let (subscriber, receiver) = telemetry::Layer::with_capacity(subscriber, TELEMETRY_CAPACITY);
set_global_default(subscriber)?;

let handle = LoggerHandle::new(level_filter_handle, receiver);
Expand Down
12 changes: 1 addition & 11 deletions logger/src/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,9 @@ impl<S: Subscriber> Layer<S> {
EventSubscriber(Self { sender, subscriber })
}

/// Create new telemetry layer with specific channel size (via const generic)
#[allow(clippy::new_ret_no_self)]
pub fn new<const CHANNEL_SIZE: usize>(
subscriber: S,
) -> (impl Subscriber, mpsc::Receiver<ChannelEvent>) {
let (sender, receiver) = mpsc::channel(CHANNEL_SIZE);
let telemetry = Self::from_senders(subscriber, sender);
(telemetry, receiver)
}

/// Create new telemetry layer with specific channel size
#[allow(clippy::new_ret_no_self)]
pub fn from_capacity(
pub fn with_capacity(
subscriber: S,
channel_size: usize,
) -> (impl Subscriber, mpsc::Receiver<ChannelEvent>) {
Expand Down

0 comments on commit 4c9bab4

Please sign in to comment.