Browse Source

Fix many `cargo clippy` warning (#1070)

pull/1075/head
Haixuan Xavier Tao GitHub 6 months ago
parent
commit
05547d841d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
14 changed files with 20 additions and 20 deletions
  1. +5
    -5
      apis/c/node/src/lib.rs
  2. +1
    -0
      apis/rust/node/src/event_stream/event.rs
  3. +1
    -0
      apis/rust/node/src/event_stream/thread.rs
  4. +2
    -2
      apis/rust/node/src/node/mod.rs
  5. +1
    -1
      binaries/daemon/src/log.rs
  6. +2
    -2
      binaries/runtime/src/operator/shared_lib.rs
  7. +2
    -2
      libraries/core/src/build/build_command.rs
  8. +0
    -2
      libraries/core/src/build/mod.rs
  9. +1
    -1
      libraries/core/src/descriptor/validate.rs
  10. +1
    -1
      libraries/core/src/descriptor/visualize.rs
  11. +1
    -1
      libraries/extensions/ros2-bridge/python/src/typed/deserialize/mod.rs
  12. +1
    -1
      libraries/extensions/ros2-bridge/python/src/typed/deserialize/primitive.rs
  13. +1
    -1
      libraries/extensions/ros2-bridge/python/src/typed/deserialize/string.rs
  14. +1
    -1
      libraries/extensions/ros2-bridge/python/src/typed/serialize/mod.rs

+ 5
- 5
apis/c/node/src/lib.rs View File

@@ -118,13 +118,13 @@ pub enum EventType {
/// ## Safety
///
/// - The `event` argument must be a dora event received through
/// [`dora_next_event`]. The event must be still valid, i.e., not
/// freed yet. The returned `out_ptr` must not be used after
/// freeing the `event`, since it points directly into the event's
/// memory.
/// [`dora_next_event`]. The event must be still valid, i.e., not
/// freed yet. The returned `out_ptr` must not be used after
/// freeing the `event`, since it points directly into the event's
/// memory.
///
/// - Note: `Out_ptr` is not a null-terminated string. The length of the string
/// is given by `out_len`.
/// is given by `out_len`.
#[no_mangle]
pub unsafe extern "C" fn read_dora_input_id(
event: *const (),


+ 1
- 0
apis/rust/node/src/event_stream/event.rs View File

@@ -9,6 +9,7 @@ use shared_memory_extended::{Shmem, ShmemConf};

#[derive(Debug)]
#[non_exhaustive]
#[allow(clippy::large_enum_variant)]
pub enum Event {
Stop(StopCause),
Reload {


+ 1
- 0
apis/rust/node/src/event_stream/thread.rs View File

@@ -27,6 +27,7 @@ pub fn init(
}

#[derive(Debug)]
#[allow(clippy::large_enum_variant)]
pub enum EventItem {
NodeEvent {
event: NodeEvent,


+ 2
- 2
apis/rust/node/src/node/mod.rs View File

@@ -161,7 +161,7 @@ impl DoraNode {

#[cfg(feature = "metrics")]
{
let id = format!("{}/{}", dataflow_id, node_id);
let id = format!("{dataflow_id}/{node_id}");
let monitor_task = async move {
if let Err(e) = run_metrics_monitor(id.clone())
.await
@@ -478,7 +478,7 @@ impl Drop for DoraNode {
}

while !self.sent_out_shared_memory.is_empty() {
if self.drop_stream.len() == 0 {
if self.drop_stream.is_empty() {
tracing::trace!(
"waiting for {} remaining drop tokens",
self.sent_out_shared_memory.len()


+ 1
- 1
binaries/daemon/src/log.rs View File

@@ -374,7 +374,7 @@ impl Logger {
.await
.wrap_err("failed to send log message to dora-coordinator")
{
Ok(()) => return,
Ok(()) => (),
Err(err) => tracing::warn!("{err:?}"),
}
}


+ 2
- 2
binaries/runtime/src/operator/shared_lib.rs View File

@@ -84,7 +84,7 @@ struct SharedLibraryOperator<'lib> {
bindings: Bindings<'lib>,
}

impl<'lib> SharedLibraryOperator<'lib> {
impl SharedLibraryOperator<'_> {
fn run(self, init_done: oneshot::Sender<Result<()>>) -> eyre::Result<StopReason> {
let operator_context = {
let DoraInitResult {
@@ -263,7 +263,7 @@ struct OperatorContext<'lib> {
drop_fn: Symbol<'lib, DoraDropOperator>,
}

impl<'lib> Drop for OperatorContext<'lib> {
impl Drop for OperatorContext<'_> {
fn drop(&mut self) {
unsafe { (self.drop_fn.drop_operator)(self.raw) };
}


+ 2
- 2
libraries/core/src/build/build_command.rs View File

@@ -50,7 +50,7 @@ pub fn run_build_command(

let mut child = cmd
.spawn()
.wrap_err_with(|| format!("failed to spawn `{}`", build))?;
.wrap_err_with(|| format!("failed to spawn `{build}`"))?;

let child_stdout = BufReader::new(child.stdout.take().expect("failed to take stdout"));
let child_stderr = BufReader::new(child.stderr.take().expect("failed to take stderr"));
@@ -74,7 +74,7 @@ pub fn run_build_command(

let exit_status = cmd
.status()
.wrap_err_with(|| format!("failed to run `{}`", build))?;
.wrap_err_with(|| format!("failed to run `{build}`"))?;
if !exit_status.success() {
return Err(eyre!("build command `{build_line}` returned {exit_status}"));
}


+ 0
- 2
libraries/core/src/build/mod.rs View File

@@ -1,8 +1,6 @@
pub use git::GitManager;
pub use logger::{BuildLogger, LogLevelOrStdout};

use url::Url;

use std::{collections::BTreeMap, future::Future, path::PathBuf};

use crate::descriptor::ResolvedNode;


+ 1
- 1
libraries/core/src/descriptor/validate.rs View File

@@ -49,7 +49,7 @@ pub fn check_dataflow(
info!("skipping path check for node with build command");
} else {
resolve_path(source, working_dir).wrap_err_with(|| {
format!("Could not find source path `{}`", source)
format!("Could not find source path `{source}`")
})?;
};
}


+ 1
- 1
libraries/core/src/descriptor/visualize.rs View File

@@ -174,7 +174,7 @@ fn visualize_inputs(
for (input_id, input) in inputs {
match &input.mapping {
mapping @ InputMapping::Timer { .. } => {
writeln!(flowchart, " {} -- {input_id} --> {target}", mapping).unwrap();
writeln!(flowchart, " {mapping} -- {input_id} --> {target}").unwrap();
}
InputMapping::User(mapping) => {
visualize_user_mapping(mapping, target, nodes, input_id, flowchart)


+ 1
- 1
libraries/extensions/ros2-bridge/python/src/typed/deserialize/mod.rs View File

@@ -55,7 +55,7 @@ struct StructVisitor<'a> {
type_info: &'a TypeInfo<'a>,
}

impl<'a, 'de> serde::de::Visitor<'de> for StructVisitor<'a> {
impl<'de> serde::de::Visitor<'de> for StructVisitor<'_> {
type Value = ArrayData;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {


+ 1
- 1
libraries/extensions/ros2-bridge/python/src/typed/deserialize/primitive.rs View File

@@ -36,7 +36,7 @@ impl<'de> serde::de::DeserializeSeed<'de> for PrimitiveDeserializer<'_> {
/// Based on https://docs.rs/serde_yaml/0.9.22/src/serde_yaml/value/de.rs.html#14-121
struct PrimitiveValueVisitor;

impl<'de> serde::de::Visitor<'de> for PrimitiveValueVisitor {
impl serde::de::Visitor<'_> for PrimitiveValueVisitor {
type Value = ArrayData;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {


+ 1
- 1
libraries/extensions/ros2-bridge/python/src/typed/deserialize/string.rs View File

@@ -17,7 +17,7 @@ impl<'de> serde::de::DeserializeSeed<'de> for StringDeserializer {
/// Based on https://docs.rs/serde_yaml/0.9.22/src/serde_yaml/value/de.rs.html#14-121
struct StringVisitor;

impl<'de> serde::de::Visitor<'de> for StringVisitor {
impl serde::de::Visitor<'_> for StringVisitor {
type Value = ArrayData;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {


+ 1
- 1
libraries/extensions/ros2-bridge/python/src/typed/serialize/mod.rs View File

@@ -100,7 +100,7 @@ impl serde::Serialize for TypedValue<'_> {
}
}

impl<'a> TypedValue<'a> {
impl TypedValue<'_> {
fn serialize_field<S>(
&self,
field: &dora_ros2_bridge_msg_gen::types::Member,


Loading…
Cancel
Save