Skip to content

Commit 2d780ee

Browse files
authored
Fix all clippy warning (dora-rs#1076)
2 parents 6d821c3 + 076e7f8 commit 2d780ee

File tree

36 files changed

+83
-102
lines changed

36 files changed

+83
-102
lines changed

apis/c++/node/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ mod ffi {
8787
}
8888
}
8989

90-
mod arrow_ffi {
91-
pub use arrow::ffi::{FFI_ArrowArray, FFI_ArrowSchema};
92-
}
93-
9490
#[cfg(feature = "ros2-bridge")]
9591
pub mod ros2 {
9692
pub use dora_ros2_bridge::*;
@@ -215,7 +211,7 @@ unsafe fn event_as_arrow_input(
215211
}
216212
}
217213
Err(e) => ffi::DoraResult {
218-
error: format!("Error exporting Arrow array to C++: {:?}", e),
214+
error: format!("Error exporting Arrow array to C++: {e:?}"),
219215
},
220216
}
221217
}
@@ -276,7 +272,7 @@ unsafe fn send_arrow_output(
276272
}
277273
}
278274
Err(e) => ffi::DoraResult {
279-
error: format!("Error importing array from C++: {:?}", e),
275+
error: format!("Error importing array from C++: {e:?}"),
280276
},
281277
}
282278
}

apis/python/node/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ impl Events {
320320
}
321321
}
322322

323+
#[allow(clippy::large_enum_variant)]
323324
enum EventsInner {
324325
Dora(EventStream),
325326
Merged(Box<dyn Stream<Item = MergedEvent<PyObject>> + Unpin + Send + Sync>),

apis/python/operator/src/lib.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -214,25 +214,13 @@ pub fn pydict_to_metadata(dict: Option<Bound<'_, PyDict>>) -> Result<MetadataPar
214214
parameters.insert(key, Parameter::Float(value.extract::<f64>()?))
215215
} else if value.is_instance_of::<PyString>() {
216216
parameters.insert(key, Parameter::String(value.extract()?))
217-
} else if value.is_instance_of::<PyTuple>()
217+
} else if (value.is_instance_of::<PyTuple>() || value.is_instance_of::<PyList>())
218218
&& value.len()? > 0
219219
&& value.get_item(0)?.is_exact_instance_of::<PyInt>()
220220
{
221221
let list: Vec<i64> = value.extract()?;
222222
parameters.insert(key, Parameter::ListInt(list))
223-
} else if value.is_instance_of::<PyList>()
224-
&& value.len()? > 0
225-
&& value.get_item(0)?.is_exact_instance_of::<PyInt>()
226-
{
227-
let list: Vec<i64> = value.extract()?;
228-
parameters.insert(key, Parameter::ListInt(list))
229-
} else if value.is_instance_of::<PyTuple>()
230-
&& value.len()? > 0
231-
&& value.get_item(0)?.is_exact_instance_of::<PyFloat>()
232-
{
233-
let list: Vec<f64> = value.extract()?;
234-
parameters.insert(key, Parameter::ListFloat(list))
235-
} else if value.is_instance_of::<PyList>()
223+
} else if (value.is_instance_of::<PyTuple>() || value.is_instance_of::<PyList>())
236224
&& value.len()? > 0
237225
&& value.get_item(0)?.is_exact_instance_of::<PyFloat>()
238226
{

apis/rust/node/src/event_stream/merged.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use futures_concurrency::stream::Merge;
88

99
/// A Dora event or an event from an external source.
1010
#[derive(Debug)]
11+
#[allow(clippy::large_enum_variant)]
1112
pub enum MergedEvent<E> {
1213
/// A Dora event
1314
Dora(super::Event),

binaries/cli/src/command/self_.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,24 @@ impl Executable for SelfSubCommand {
5555
);
5656
} else {
5757
println!(
58-
"Dora CLI is already at the latest version: {}",
59-
current_version
58+
"Dora CLI is already at the latest version: {current_version}"
6059
);
6160
}
6261
}
63-
Err(e) => println!("Failed to check for updates: {}", e),
62+
Err(e) => println!("Failed to check for updates: {e}"),
6463
}
6564
} else {
6665
// Perform the actual update
6766
match status.update() {
6867
Ok(update_status) => match update_status {
6968
self_update::Status::UpToDate(version) => {
70-
println!("Dora CLI is already at the latest version: {}", version);
69+
println!("Dora CLI is already at the latest version: {version}");
7170
}
7271
self_update::Status::Updated(version) => {
73-
println!("Successfully updated Dora CLI to version: {}", version);
72+
println!("Successfully updated Dora CLI to version: {version}");
7473
}
7574
},
76-
Err(e) => println!("Failed to update: {}", e),
75+
Err(e) => println!("Failed to update: {e}"),
7776
}
7877
}
7978
}

binaries/daemon/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ impl Daemon {
10701070
for task in tasks {
10711071
let NodeBuildTask {
10721072
node_id,
1073-
dynamic_node,
1073+
dynamic_node: _,
10741074
task,
10751075
} = task;
10761076
let node = task
@@ -2680,6 +2680,7 @@ impl Event {
26802680
}
26812681

26822682
#[derive(Debug)]
2683+
#[allow(clippy::large_enum_variant)]
26832684
pub enum DaemonNodeEvent {
26842685
OutputsDone {
26852686
reply_sender: oneshot::Sender<DaemonReply>,

binaries/daemon/src/log.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ struct Indent<'a>(&'a str);
416416
impl std::fmt::Display for Indent<'_> {
417417
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
418418
for line in self.0.lines() {
419-
write!(f, " {}", line)?;
419+
write!(f, " {line}")?;
420420
}
421421
Ok(())
422422
}

binaries/daemon/src/node_communication/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ pub async fn spawn_listener_loop(
152152
if !tmpfile_dir.exists() {
153153
std::fs::create_dir_all(&tmpfile_dir).context("could not create tmp dir")?;
154154
}
155-
let socket_file = tmpfile_dir.join(format!("{}.sock", node_id));
155+
let socket_file = tmpfile_dir.join(format!("{node_id}.sock"));
156156
let socket = match UnixListener::bind(&socket_file) {
157157
Ok(socket) => socket,
158158
Err(err) => {

binaries/daemon/src/node_communication/shmem.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub async fn listener_loop(
4242
Listener::run(connection, daemon_tx, clock).await
4343
}
4444

45+
#[allow(clippy::large_enum_variant)]
4546
enum Operation {
4647
Receive(oneshot::Sender<eyre::Result<Option<Timestamped<DaemonRequest>>>>),
4748
Send {

binaries/daemon/src/spawn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ async fn path_spawn_command(
633633
.wrap_err("failed to download custom node")?
634634
} else {
635635
resolve_path(source, working_dir)
636-
.wrap_err_with(|| format!("failed to resolve node source `{}`", source))?
636+
.wrap_err_with(|| format!("failed to resolve node source `{source}`"))?
637637
};
638638

639639
// If extension is .py, use python to run the script

0 commit comments

Comments
 (0)