Skip to content

Commit

Permalink
chore: fix clippy lints on latest nightly (#960)
Browse files Browse the repository at this point in the history
  • Loading branch information
MingweiSamuel authored Nov 7, 2023
1 parent 43280cb commit ba6afab
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion hydro_cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn deploy(config: PathBuf, args: Vec<String>) -> anyhow::Result<()> {
.value(py)
.getattr("args")?
.extract::<Vec<AnyhowWrapper>>()?;
let wrapper = args.get(0).unwrap();
let wrapper = args.first().unwrap();
let underlying = &wrapper.underlying;
let mut underlying = underlying.blocking_write();
Err(underlying.take().unwrap()).context(traceback)
Expand Down
1 change: 1 addition & 0 deletions hydroflow/examples/deadlock_detector/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub(crate) async fn run_detector(opts: Opts, peer_list: Vec<String>) {
let reader = tokio::io::BufReader::new(tokio::io::stdin());
let stdin_lines = LinesStream::new(reader.lines());

#[allow(clippy::map_identity)]
let mut hf: Hydroflow = hydroflow_syntax! {
// fetch peers from file, convert ip:port to a SocketAddr, and tee
peers = source_iter(peer_list)
Expand Down
3 changes: 2 additions & 1 deletion hydroflow/examples/three_clique/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub fn main() {
// An edge in the input data = a pair of `usize` vertex IDs.
let (edges_send, edges_recv) = hydroflow::util::unbounded_channel::<(usize, usize)>();

#[allow(clippy::map_identity)]
let mut df = hydroflow_syntax! {
edges = source_stream(edges_recv) -> tee();

Expand All @@ -30,7 +31,7 @@ pub fn main() {
// wire the inputs to the joins
edges[0] -> map(|(y,z)| (z,y)) -> [0]edge_pairs;
edges[1] -> [1]edge_pairs;
edge_pairs -> map(|((z,x), y)| ((z, x), y)) -> [0]triangle;
edge_pairs -> map(|((z, x), y)| ((z, x), y)) -> [0]triangle;
edges[2] -> map(|(z,x)| ((z,x), ())) -> [1]triangle;

// post-process: sort fields of each tuple by node ID
Expand Down
2 changes: 1 addition & 1 deletion hydroflow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pub use {
rustc_hash, serde, serde_json, tokio, tokio_stream, tokio_util,
};

/// `#[macro_use]` automagically brings the declarative macro export to the crate-level.
mod declarative_macro;
pub use declarative_macro::*;
#[cfg(feature = "hydroflow_datalog")]
pub use hydroflow_datalog::*;
#[cfg(feature = "hydroflow_macro")]
Expand Down
2 changes: 1 addition & 1 deletion hydroflow_lang/src/graph/ops/_lattice_fold_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub const _LATTICE_FOLD_BATCH: OperatorConstraints = OperatorConstraints {
assert!(is_pull);

let lattice_type = type_args
.get(0)
.first()
.map(ToTokens::to_token_stream)
.unwrap_or(quote_spanned!(op_span=> _));

Expand Down
2 changes: 1 addition & 1 deletion hydroflow_lang/src/graph/ops/fold_keyed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub const FOLD_KEYED: OperatorConstraints = OperatorConstraints {

let generic_type_args = [
type_args
.get(0)
.first()
.map(ToTokens::to_token_stream)
.unwrap_or(quote_spanned!(op_span=> _)),
type_args
Expand Down
2 changes: 1 addition & 1 deletion hydroflow_lang/src/graph/ops/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub const JOIN: OperatorConstraints = OperatorConstraints {
diagnostics| {
let join_type =
type_args
.get(0)
.first()
.map(ToTokens::to_token_stream)
.unwrap_or(quote_spanned!(op_span=>
#root::compiled::pull::HalfSetJoinState
Expand Down
6 changes: 3 additions & 3 deletions hydroflow_lang/src/graph/ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ pub fn identity_write_iterator_fn(
}: &WriteContextArgs,
) -> TokenStream {
let generic_type = type_args
.get(0)
.first()
.map(quote::ToTokens::to_token_stream)
.unwrap_or(quote_spanned!(op_span=> _));

Expand Down Expand Up @@ -302,7 +302,7 @@ pub fn null_write_iterator_fn(
}: &WriteContextArgs,
) -> TokenStream {
let default_type = parse_quote_spanned! {op_span=> _};
let iter_type = type_args.get(0).unwrap_or(&default_type);
let iter_type = type_args.first().unwrap_or(&default_type);
if is_pull {
quote_spanned! {op_span=>
#(
Expand Down Expand Up @@ -494,7 +494,7 @@ impl WriteContextArgs<'_> {
let span = self.op_span;
match self
.flow_props_in
.get(0)
.first()
.copied()
.flatten()
.and_then(|flow_props| flow_props.lattice_flow_type)
Expand Down
2 changes: 1 addition & 1 deletion hydroflow_lang/src/graph/ops/reduce_keyed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub const REDUCE_KEYED: OperatorConstraints = OperatorConstraints {

let generic_type_args = [
type_args
.get(0)
.first()
.map(ToTokens::to_token_stream)
.unwrap_or(quote_spanned!(op_span=> _)),
type_args
Expand Down
2 changes: 1 addition & 1 deletion hydroflow_lang/src/graph/ops/source_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub const SOURCE_JSON: OperatorConstraints = OperatorConstraints {
..
},
_| {
let generic_type = type_args.get(0).map(|ty| quote_spanned!(op_span=> : #ty));
let generic_type = type_args.first().map(|ty| quote_spanned!(op_span=> : #ty));

let ident_jsonread = wc.make_ident("jsonread");
let write_prologue = quote_spanned! {op_span=>
Expand Down
2 changes: 1 addition & 1 deletion hydroflow_lang/src/graph/propegate_flow_props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn propegate_flow_props(
for (i, edge_id) in out_edges.into_iter().enumerate() {
if let Some(flow_prop_out) = *flow_props_out
.get(i)
.unwrap_or_else(|| flow_props_out.get(0).unwrap())
.unwrap_or_else(|| flow_props_out.first().unwrap())
{
let flow_prop_old =
graph.set_edge_flow_props(edge_id, flow_prop_out);
Expand Down
4 changes: 4 additions & 0 deletions lattices/src/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,8 @@ where
Q: Eq + ?Sized,
{
fn get_key_value(&self, key: &'a Q) -> Option<(Self::KeyRef<'_>, Self::ItemRef<'_>)> {
// TODO(mingwei): https://github.com/rust-lang/rust-clippy/issues/11764
#[allow(clippy::map_identity)]
self.0
.as_ref()
.filter(|(k, _v)| key == k.borrow())
Expand Down Expand Up @@ -623,6 +625,8 @@ impl<K, V> MapIter for OptionMap<K, V> {
Self: 'a;

fn iter(&self) -> Self::Iter<'_> {
// TODO(mingwei): https://github.com/rust-lang/rust-clippy/issues/11764
#[allow(clippy::map_identity)]
self.0.as_ref().map(|(k, v)| (k, v)).into_iter()
}
}
Expand Down

0 comments on commit ba6afab

Please sign in to comment.