// SPDX-License-Identifier: GPL-3.0-or-later WITH LicenseRef-Hippotat-OpenSSL-Exception
// There is NO WARRANTY.
+#![allow(clippy::style)]
+
+#![allow(clippy::unit_arg)]
+#![allow(clippy::useless_format)]
+#![allow(clippy::while_let_loop)]
+
use hippotat::prelude::*;
use hippotat_macros::into_crlfs;
dyn Future<Output=Option<Box<[u8]>>> + Send + 'r
>>;
-impl<T> HCC for T where
+impl<T> Hcc for T where
T: hyper::client::connect::Connect + Clone + Send + Sync + 'static { }
-trait HCC: hyper::client::connect::Connect + Clone + Send + Sync + 'static { }
+trait Hcc: hyper::client::connect::Connect + Clone + Send + Sync + 'static { }
struct ClientContext<'c,C> {
ic: &'c InstanceConfig,
}
#[throws(AE)]
-fn submit_request<'r, 'c:'r, C:HCC>(
+fn submit_request<'r, 'c:'r, C:Hcc>(
c: &'c ClientContext<C>,
req_num: &mut ReqNum,
reqs: &mut Vec<OutstandingRequest<'r>>,
//dbg!(DumpHex(&hmac));
let mut token = time_t;
write!(token, " ").unwrap();
- base64::encode_config_buf(&hmac, BASE64_CONFIG, &mut token);
+ base64::encode_config_buf(hmac, BASE64_CONFIG, &mut token);
let req_num = { *req_num += 1; *req_num };
reqs.push(fut);
}
-async fn run_client<C:HCC>(
+async fn run_client<C:Hcc>(
ic: InstanceConfig,
hclient: Arc<hyper::Client<C>>
) -> Result<Void, AE>
//! This crate is an internal detail of hippotat.
//! It does not adhere to semver.
+#![allow(clippy::style)]
+
+#![allow(clippy::expect_fun_call)]
+#![allow(clippy::map_flatten)]
+#![allow(clippy::single_char_pattern)]
+
use syn::{parse_macro_input, parse_quote};
use syn::{Data, DataStruct, DeriveInput, LitStr, Meta, NestedMeta};
use quote::{quote, quote_spanned, ToTokens};
for attr in &field.attrs {
let atspan = attr.path.segments.last().unwrap().ident.span();
if attr.tokens.is_empty() {
- if &attr.path == &parse_quote!{ per_client } {
+ if attr.path == parse_quote!{ per_client } {
set_skl(quote_spanned!{fname_span=> SectionKindList::PerClient });
continue;
- } else if &attr.path == &parse_quote!{ global } {
+ } else if attr.path == parse_quote!{ global } {
set_skl(quote_spanned!{fname_span=> SectionKindList::Global });
global_fields.push(syn::Field {
attrs: vec![],
continue;
}
method = attr.path.to_token_stream();
- if &attr.path == &parse_quote!{ limited } {
+ if attr.path == parse_quote!{ limited } {
set_skl(quote_spanned!{atspan=> SectionKindList::Limited });
- } else if &attr.path == &parse_quote!{ client } {
+ } else if attr.path == parse_quote!{ client } {
set_skl(quote_spanned!{atspan=> SectionKindList::PerClient });
- } else if &attr.path == &parse_quote!{ computed } {
+ } else if attr.path == parse_quote!{ computed } {
set_skl(quote_spanned!{atspan=> SectionKindList::None });
}
- } else if &attr.path == &parse_quote!{ special } {
+ } else if attr.path == parse_quote!{ special } {
let meta = match attr.parse_meta().unwrap() {
Meta::List(list) => list,
_ => panic!(),
// SPDX-License-Identifier: GPL-3.0-or-later WITH LicenseRef-Hippotat-OpenSSL-Exception
// There is NO WARRANTY.
+#![allow(clippy::style)]
+
+#![allow(clippy::unit_arg)]
+#![allow(clippy::useless_format)]
+#![allow(clippy::while_let_loop)]
+
use hippotat::prelude::*;
mod daemon;
tasks.push((task, format!("http server {}", addr)));
}
- let global_ = global.clone();
+ #[allow(clippy::redundant_clone)] let global_ = global.clone();
let ipif = tokio::task::spawn(async move {
slocal::run(global_, local_tx_recv, ipif).await
.void_unwrap_err()
debug!("{} error {}", &conn, &e);
let mut errmsg = format!("ERROR\n\n{:?}\n\n", &e);
for w in warnings.warnings {
- write!(errmsg, "warning: {}\n", w).unwrap();
+ writeln!(errmsg, "warning: {}", w).unwrap();
}
hyper::Response::builder()
.status(hyper::StatusCode::BAD_REQUEST)
match end {
LinkEnd::Client => {
- if &self.url == &default::<Uri>() {
+ if self.url == default::<Uri>() {
let addr = self.addrs.get(0).ok_or_else(
|| anyhow!("client needs addrs or url set")
)?;
let bad = parking_lot::Mutex::new(vec![]);
*var = regex_replace_all!(
r#"%(?:%|\((\w+)\)s|\{(\w+)\}|.)"#,
- &var,
+ var,
|whole, k1, k2| (|| Ok::<_,String>({
if whole == "%%" { "%" }
else if let Some(&k) = [k1,k2].iter().find(|&&s| s != "") {
#[throws(AE)]
pub fn start(cmd: &str, ic_name: Option<String>) -> Self {
let mut child = tokio::process::Command::new("sh")
- .args(&["-c", cmd])
+ .args(["-c", cmd])
.stdin (process::Stdio::piped())
.stdout(process::Stdio::piped())
.stderr(process::Stdio::piped())
//! Please refer to the
//! [project documentation](https://www.chiark.greenend.org.uk/~ianmdlvl/hippotat/current/docs/)
+#![allow(clippy::style)]
+
+#![allow(clippy::clone_on_copy)]
+#![allow(clippy::map_flatten)]
+#![allow(clippy::match_single_binding)]
+#![allow(clippy::single_char_pattern)]
+#![allow(clippy::unit_arg)]
+#![allow(clippy::useless_format)]
+
pub mod prelude;
pub mod config;
Some(c) => c,
};
- let next_boundary = self.boundary_finder.find(&comp.payload)
+ let next_boundary = self.boundary_finder.find(comp.payload)
.ok_or(MissingBoundary)?;
self.at_boundary = &comp.payload[next_boundary..];
}
fn push_esc_(&mut self, b: Box<[u8]>) {
self.queue.push_( QueuedBytesOwned(b));
- self.queue.push_(QueuedBytesBorrowed(&SLIP_END_SLICE));
+ self.queue.push_(QueuedBytesBorrowed(SLIP_END_SLICE));
}
pub fn esc_push(&mut self, b: Box<[u8]>) {
- self.queue.push_(QueuedBytesBorrowed(&SLIP_END_SLICE));
+ self.queue.push_(QueuedBytesBorrowed(SLIP_END_SLICE));
self.queue.push_(QueuedBytesOwned(b));
}
pub fn push_raw(&mut self, b: Box<[u8]>) {
throw!(PacketError::MTU { len: decoded_len, mtu });
}
- let acr = addr_chk(&header)?;
+ let acr = addr_chk(header)?;
(packet, acr)
}
//dbg!(DumpHex(&key), DumpHex(message), DumpHex(&ikey), DumpHex(&okey));
let h1 = HmacH::new()
- .chain(&ikey)
+ .chain(ikey)
.chain(message)
.finalize();
let h2 = HmacH::new()
- .chain(&okey)
+ .chain(okey)
.chain(h1)
.finalize();
h2.into()