From 6c6f026b6965fdf0ae1bf252f4c8e8e1f02fe9dc Mon Sep 17 00:00:00 2001 From: Dominik Werder Date: Wed, 19 Jan 2022 14:05:19 +0100 Subject: [PATCH] Adapt format interpolation --- disk/src/binned.rs | 20 +++++++------------- disk/src/binned/binnedfrompbv.rs | 22 ++++++++++++---------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/disk/src/binned.rs b/disk/src/binned.rs index 2479bd7..ab03f39 100644 --- a/disk/src/binned.rs +++ b/disk/src/binned.rs @@ -82,11 +82,10 @@ impl ChannelExecFunction for BinnedBinaryChannelExec { let perf_opts = PerfOpts { inmem_bufcap: 512 }; let souter = match PreBinnedPatchRange::covering_range(self.query.range().clone(), self.query.bin_count()) { Ok(Some(pre_range)) => { - debug!("BinnedBinaryChannelExec found pre_range: {:?}", pre_range); + debug!("BinnedBinaryChannelExec found pre_range: {pre_range:?}"); if range.grid_spec.bin_t_len() < pre_range.grid_spec.bin_t_len() { let msg = format!( - "BinnedBinaryChannelExec incompatible ranges:\npre_range: {:?}\nrange: {:?}", - pre_range, range + "BinnedBinaryChannelExec incompatible ranges:\npre_range: {pre_range:?}\nrange: {range:?}" ); return Err(Error::with_msg(msg)); } @@ -110,8 +109,7 @@ impl ChannelExecFunction for BinnedBinaryChannelExec { } Ok(None) => { debug!( - "BinnedBinaryChannelExec no covering range for prebinned, merge from remotes instead {:?}", - range + "BinnedBinaryChannelExec no covering range for prebinned, merge from remotes instead {range:?}" ); let evq = RawEventsQuery { channel: self.query.channel().clone(), @@ -226,7 +224,7 @@ where S: Stream> + Unpin, T: Collectable, { - info!("\n\nConstruct deadline with timeout {:?}\n\n", timeout); + info!("\n\nConstruct deadline with timeout {timeout:?}\n\n"); let deadline = tokio::time::Instant::now() + timeout; let mut collector = ::new_collector(bin_count_exp); let mut i1 = 0; @@ -327,11 +325,10 @@ impl ChannelExecFunction for BinnedJsonChannelExec { let perf_opts = PerfOpts { inmem_bufcap: 512 }; let souter = match PreBinnedPatchRange::covering_range(self.query.range().clone(), self.query.bin_count()) { Ok(Some(pre_range)) => { - debug!("BinnedJsonChannelExec found pre_range: {:?}", pre_range); + debug!("BinnedJsonChannelExec found pre_range: {pre_range:?}"); if range.grid_spec.bin_t_len() < pre_range.grid_spec.bin_t_len() { let msg = format!( - "BinnedJsonChannelExec incompatible ranges:\npre_range: {:?}\nrange: {:?}", - pre_range, range + "BinnedJsonChannelExec incompatible ranges:\npre_range: {pre_range:?}\nrange: {range:?}" ); return Err(Error::with_msg(msg)); } @@ -355,10 +352,7 @@ impl ChannelExecFunction for BinnedJsonChannelExec { Ok(Box::pin(s) as Pin> + Send>>) } Ok(None) => { - debug!( - "BinnedJsonChannelExec no covering range for prebinned, merge from remotes instead {:?}", - range - ); + debug!("BinnedJsonChannelExec no covering range for prebinned, merge from remotes instead {range:?}"); let evq = RawEventsQuery { channel: self.query.channel().clone(), range: self.query.range().clone(), diff --git a/disk/src/binned/binnedfrompbv.rs b/disk/src/binned/binnedfrompbv.rs index 0ee4573..7f0a9d9 100644 --- a/disk/src/binned/binnedfrompbv.rs +++ b/disk/src/binned/binnedfrompbv.rs @@ -35,7 +35,11 @@ impl FetchedPreBinned { pub fn new(query: &PreBinnedQuery, node_config: &NodeConfigCached) -> Result { let nodeix = node_ix_for_patch(&query.patch(), &query.channel(), &node_config.node_config.cluster); let node = &node_config.node_config.cluster.nodes[nodeix as usize]; - let mut url = Url::parse(&format!("http://{}:{}/api/4/prebinned", node.host, node.port))?; + let mut url = { + let host = &node.host; + let port = node.port; + Url::parse(&format!("http://{host}:{port}/api/4/prebinned"))? + }; query.append_to_url(&mut url); let ret = Self { uri: Uri::from_str(&url.to_string()).map_err(Error::from_string)?, @@ -102,18 +106,16 @@ where self.res = Some(s2); continue 'outer; } else { - let msg = format!( - "PreBinnedValueFetchedStream got non-OK result from sub request: {:?}", - res - ); - error!("{}", msg); + let msg = + format!("PreBinnedValueFetchedStream got non-OK result from sub request: {res:?}"); + error!("{msg}"); let e = Error::with_msg_no_trace(msg); self.errored = true; Ready(Some(Err(e))) } } Err(e) => { - error!("PreBinnedValueStream error in stream {:?}", e); + error!("PreBinnedValueStream error in stream {e:?}"); self.errored = true; Ready(Some(Err(Error::from_string(e)))) } @@ -176,9 +178,9 @@ where // Convert this to a StreamLog message: for (i, p) in patches.iter().enumerate() { use std::fmt::Write; - write!(sp, " • patch {:2} {:?}\n", i, p)?; + write!(sp, " • patch {i:2} {p:?}\n")?; } - info!("Using these pre-binned patches:\n{}", sp); + info!("Using these pre-binned patches:\n{sp}"); } let pmax = patches.len(); let inp = futures_util::stream::iter(patches.into_iter().enumerate()) @@ -199,7 +201,7 @@ where match FetchedPreBinned::::new(&query, &node_config) { Ok(stream) => Box::pin(stream.map(move |q| (pix, q))), Err(e) => { - error!("error from PreBinnedValueFetchedStream::new {:?}", e); + error!("error from PreBinnedValueFetchedStream::new {e:?}"); Box::pin(futures_util::stream::iter(vec![(pix, Err(e))])) } };