Skip to content

Commit

Permalink
style: fixes for latest nightly clippy (#1537)
Browse files Browse the repository at this point in the history
  • Loading branch information
MingweiSamuel committed Nov 6, 2024
1 parent 4fcba1d commit 8442d1b
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 33 deletions.
1 change: 0 additions & 1 deletion datastores/gossip_kv/server/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ where
}

/// Setup deserialization for inbound networking messages.
fn setup_inbound_deserialization<Inbound, Message>(
inbound: Inbound,
) -> impl hydroflow::futures::Stream<Item = (Message, SocketAddr)>
Expand Down
2 changes: 1 addition & 1 deletion datastores/gossip_kv/server/membership.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use gossip_kv::membership::MemberId;
// use rand::distributions::Distribution;
// use rand::{Rng};

/// This is a simple distribution that generates a random lower-case alphanumeric
// /// This is a simple distribution that generates a random lower-case alphanumeric
// struct LowercaseAlphanumeric;
//
// impl Distribution<char> for LowercaseAlphanumeric {
Expand Down
5 changes: 5 additions & 0 deletions hydro_deploy/core/src/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ impl Deployment {
/// Buildstructor methods.
#[buildstructor::buildstructor]
impl Deployment {
#[allow(
clippy::allow_attributes,
clippy::too_many_arguments,
reason = "buildstructor"
)]
#[builder(entry = "GcpComputeEngineHost", exit = "add")]
pub fn add_gcp_compute_engine_host(
&mut self,
Expand Down
1 change: 1 addition & 0 deletions hydro_deploy/core/src/hydroflow_crate/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ pub async fn build_crate_memoized(params: BuildParams) -> Result<&'static BuildO
let path_buf: PathBuf = path.clone().into();
let path = path.into_string();
let data = std::fs::read(path).unwrap();
assert!(spawned.wait().unwrap().success());
return Ok(BuildOutput {
unique_id: nanoid!(8),
bin_data: data,
Expand Down
2 changes: 2 additions & 0 deletions hydro_deploy/core/src/hydroflow_crate/tracing_options.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::too_many_arguments, reason = "buildstructor")]

use std::path::PathBuf;

use inferno::collapse::dtrace::Options as DtraceOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct MapUnionHashMapWrapper<'a, const SIZE: usize>(
pub &'a MapUnionHashMap<u64, MyLastWriteWins<SIZE>>,
);

impl<'a, const SIZE: usize> Serialize for MapUnionHashMapWrapper<'a, SIZE> {
impl<const SIZE: usize> Serialize for MapUnionHashMapWrapper<'_, SIZE> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::protocol::MyLastWriteWins;
#[repr(transparent)]
pub struct MyLastWriteWinsWrapper<'a, const SIZE: usize>(pub &'a MyLastWriteWins<SIZE>);

impl<'a, const SIZE: usize> Serialize for MyLastWriteWinsWrapper<'a, SIZE> {
impl<const SIZE: usize> Serialize for MyLastWriteWinsWrapper<'_, SIZE> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::buffer_pool::{AutoReturnBuffer, AutoReturnBufferDeserializer, BufferP
#[repr(transparent)]
pub struct PointWrapper<'a, const SIZE: usize>(pub &'a Point<AutoReturnBuffer<SIZE>, ()>);

impl<'a, const SIZE: usize> Serialize for PointWrapper<'a, SIZE> {
impl<const SIZE: usize> Serialize for PointWrapper<'_, SIZE> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct WithBotWrapper<'a, const SIZE: usize>(
pub &'a WithBot<Point<AutoReturnBuffer<SIZE>, ()>>,
);

impl<'a, const SIZE: usize> Serialize for WithBotWrapper<'a, SIZE> {
impl<const SIZE: usize> Serialize for WithBotWrapper<'_, SIZE> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
2 changes: 1 addition & 1 deletion hydroflow/examples/kvs_bench/protocol/serialization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ enum KvsRequestField {
Delete,
}
struct KvsRequestFieldVisitor;
impl<'de> Visitor<'de> for KvsRequestFieldVisitor {
impl Visitor<'_> for KvsRequestFieldVisitor {
type Value = KvsRequestField;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion hydroflow/src/scheduled/net/network_vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub type Address = String;
// These methods can't be wrapped up in a trait because async methods are not
// allowed in traits (yet).

impl<'a> Hydroflow<'a> {
impl Hydroflow<'_> {
// TODO(justin): document these, but they're derivatives of inbound_tcp_vertex_internal.
pub async fn inbound_tcp_vertex_port<T>(&mut self, port: u16) -> RecvPort<VecHandoff<T>>
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use hydroflow::hydroflow_syntax;

fn main() {
let mut df = hydroflow_syntax! {
source_iter(5) -> for_each(std::mem::drop);
source_iter(()) -> for_each(std::mem::drop);
};
df.run_available();
}
45 changes: 22 additions & 23 deletions hydroflow/tests/compile-fail/surface_source_iter_badtype.stderr
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
error[E0277]: `{integer}` is not an iterator
error[E0277]: `()` is not an iterator
--> tests/compile-fail/surface_source_iter_badtype.rs:5:21
|
5 | source_iter(5) -> for_each(std::mem::drop);
| ------------^-
5 | source_iter(()) -> for_each(std::mem::drop);
| ------------^^-
| | |
| | `{integer}` is not an iterator
| | `()` is not an iterator
| required by a bound introduced by this call
|
= help: the trait `Iterator` is not implemented for `{integer}`, which is required by `{integer}: IntoIterator`
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
= note: required for `{integer}` to implement `IntoIterator`
= help: the trait `Iterator` is not implemented for `()`, which is required by `(): IntoIterator`
= note: required for `()` to implement `IntoIterator`
note: required by a bound in `check_iter`
--> tests/compile-fail/surface_source_iter_badtype.rs:5:9
|
5 | source_iter(5) -> for_each(std::mem::drop);
| ^^^^^^^^^^^^^^ required by this bound in `check_iter`
5 | source_iter(()) -> for_each(std::mem::drop);
| ^^^^^^^^^^^^^^^ required by this bound in `check_iter`

error[E0277]: `{integer}` is not an iterator
error[E0277]: `()` is not an iterator
--> tests/compile-fail/surface_source_iter_badtype.rs:5:9
|
5 | source_iter(5) -> for_each(std::mem::drop);
| ^^^^^^^^^^^^^^ `{integer}` is not an iterator
5 | source_iter(()) -> for_each(std::mem::drop);
| ^^^^^^^^^^^^^^^ `()` is not an iterator
|
= help: the trait `Iterator` is not implemented for `{integer}`, which is required by `{integer}: IntoIterator`
= note: required for `{integer}` to implement `IntoIterator`
= help: the trait `Iterator` is not implemented for `()`, which is required by `(): IntoIterator`
= note: required for `()` to implement `IntoIterator`
note: required by a bound in `check_iter`
--> tests/compile-fail/surface_source_iter_badtype.rs:5:9
|
5 | source_iter(5) -> for_each(std::mem::drop);
| ^^^^^^^^^^^^^^ required by this bound in `check_iter`
5 | source_iter(()) -> for_each(std::mem::drop);
| ^^^^^^^^^^^^^^^ required by this bound in `check_iter`

error[E0277]: `{integer}` is not an iterator
error[E0277]: `()` is not an iterator
--> tests/compile-fail/surface_source_iter_badtype.rs:5:9
|
5 | source_iter(5) -> for_each(std::mem::drop);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `{integer}` is not an iterator
5 | source_iter(()) -> for_each(std::mem::drop);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator
|
= help: the trait `Iterator` is not implemented for `{integer}`, which is required by `{integer}: IntoIterator`
= note: required for `{integer}` to implement `IntoIterator`
= help: the trait `Iterator` is not implemented for `()`, which is required by `(): IntoIterator`
= note: required for `()` to implement `IntoIterator`
note: required by a bound in `check_iter`
--> tests/compile-fail/surface_source_iter_badtype.rs:5:9
|
5 | source_iter(5) -> for_each(std::mem::drop);
| ^^^^^^^^^^^^^^ required by this bound in `check_iter`
5 | source_iter(()) -> for_each(std::mem::drop);
| ^^^^^^^^^^^^^^^ required by this bound in `check_iter`
6 changes: 5 additions & 1 deletion hydroflow_datalog_core/src/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ pub mod datalog {
}

#[derive(Debug, Clone)]
#[expect(clippy::manual_non_exhaustive, reason = "`()` used for leaf")]
#[allow(
clippy::allow_attributes,
clippy::manual_non_exhaustive,
reason = "`()` used for leaf"
)]
pub struct AtNode {
#[rust_sitter::leaf(text = "@")]
_at: (),
Expand Down

0 comments on commit 8442d1b

Please sign in to comment.