Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions node/metered-channel/src/oneshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub fn channel<T>(
let (tx, rx) = oneshot::channel();

(
MeteredSender { name, inner: tx },
MeteredSender { inner: tx },
MeteredReceiver {
name,
inner: rx,
Expand Down Expand Up @@ -113,14 +113,13 @@ impl Measurable for Error {
/// Oneshot sender, created by [`channel`].
#[derive(Debug)]
pub struct MeteredSender<T> {
name: &'static str,
inner: oneshot::Sender<(Instant, T)>,
}

impl<T> MeteredSender<T> {
/// Send a value.
pub fn send(self, t: T) -> Result<(), T> {
let Self { inner, name: _ } = self;
let Self { inner } = self;
inner.send((Instant::now(), t)).map_err(|(_, t)| t)
}

Expand Down
2 changes: 1 addition & 1 deletion node/overseer/overseer-gen/proc-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ assert_matches = "1.5.0"
[features]
default = []
# write the expanded version to a `overlord-expansion.rs`
# in the `cwd`
# in the `OUT_DIR` as defined by `cargo`.
expansion = []
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ pub(crate) fn impl_channels_out_struct(info: &OverseerInfo) -> Result<proc_macro
)*
}

#[allow(unreachable_code)] // when no defined messages in enum
#[allow(unreachable_code)]
// when no defined messages in enum
impl ChannelsOut {
/// Send a message via a bounded channel.
pub async fn send_and_log_error(
Expand Down
2 changes: 2 additions & 0 deletions node/overseer/overseer-gen/proc-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ pub(crate) fn impl_overseer_gen(
additive.extend(impl_message_wrapper_enum(&info)?);
additive.extend(impl_dispatch(&info));

// Write to a file for expansion, and then use it via `include!()`
// in order to obtain better compiler errors when modifying `overlord`.
if cfg!(feature = "expansion") {
use std::io::Write;

Expand Down