Browse Source

Fix clippy warnings across whole projects

tags/v0.0.0-test.4
Philipp Oppermann 3 years ago
parent
commit
f473c856c1
Failed to extract signature
8 changed files with 15 additions and 20 deletions
  1. +2
    -0
      apis/python/node/src/lib.rs
  2. +5
    -4
      apis/rust/node/src/communication.rs
  3. +2
    -2
      apis/rust/node/src/config.rs
  4. +1
    -1
      apis/rust/operator/src/raw.rs
  5. +1
    -1
      binaries/coordinator/src/lib.rs
  6. +2
    -0
      binaries/runtime/src/operator/python.rs
  7. +1
    -6
      examples/iceoryx/sink/src/main.rs
  8. +1
    -6
      examples/rust-dataflow/sink/src/main.rs

+ 2
- 0
apis/python/node/src/lib.rs View File

@@ -1,3 +1,5 @@
#![allow(clippy::borrow_deref_ref)] // clippy warns about code generated by #[pymethods]

use dora_node_api::{config::NodeId, DoraNode, Input};
use eyre::{Context, Result};
use flume::Receiver;


+ 5
- 4
apis/rust/node/src/communication.rs View File

@@ -7,9 +7,10 @@ use crate::{
use eyre::Context;
use std::{
collections::{BTreeMap, HashSet},
mem, thread,
mem,
ops::Deref,
thread,
};
use uuid::Uuid;

#[doc(hidden)]
pub const STOP_TOPIC: &str = "__dora_rs_internal__operator_stopped";
@@ -24,7 +25,7 @@ pub fn init(
prefix: zenoh_prefix,
} => {
let layer = communication_layer_pub_sub::zenoh::ZenohCommunicationLayer::init(
zenoh_config.clone(),
zenoh_config.deref().clone(),
zenoh_prefix.clone(),
)
.map_err(|err| eyre::eyre!(err))?;
@@ -44,7 +45,7 @@ pub fn init(
topic_prefix,
} => {
let app_name_prefix = app_name_prefix.clone();
let app_name = format!("{app_name_prefix}-{}", Uuid::new_v4());
let app_name = format!("{app_name_prefix}-{}", uuid::Uuid::new_v4());
let instance_name = topic_prefix.clone();
let layer = communication_layer_pub_sub::iceoryx::IceoryxCommunicationLayer::init(
app_name,


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

@@ -267,7 +267,7 @@ pub struct UserInputMapping {
pub enum CommunicationConfig {
Zenoh {
#[serde(default)]
config: zenoh_config::Config,
config: Box<zenoh_config::Config>,
prefix: String,
},
Iceoryx {
@@ -288,7 +288,7 @@ impl CommunicationConfig {
}
CommunicationConfig::Iceoryx { topic_prefix, .. } => {
if !topic_prefix.is_empty() {
topic_prefix.push_str("-");
topic_prefix.push('-');
}
topic_prefix.push_str(prefix);
}


+ 1
- 1
apis/rust/operator/src/raw.rs View File

@@ -35,7 +35,7 @@ pub unsafe fn dora_on_input<O: DoraOperator>(

let operator: &mut O = unsafe { &mut *operator_context.cast() };
let data = input.data.as_ref().as_slice();
match operator.on_input(&input.id, &data, &mut output_sender) {
match operator.on_input(&input.id, data, &mut output_sender) {
Ok(status) => OnInputResult {
result: DoraResult { error: None },
status,


+ 1
- 1
binaries/coordinator/src/lib.rs View File

@@ -116,7 +116,7 @@ async fn run_dataflow(dataflow_path: PathBuf, runtime: &Path) -> eyre::Result<()
format!("dora/timer/{duration}")
};
let mut stream = IntervalStream::new(tokio::time::interval(interval));
while let Some(_) = stream.next().await {
while (stream.next().await).is_some() {
communication
.publisher(&topic)
.unwrap()


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

@@ -1,3 +1,5 @@
#![allow(clippy::borrow_deref_ref)] // clippy warns about code generated by #[pymethods]

use super::OperatorEvent;
use dora_node_api::{communication::Publisher, config::DataId};
use eyre::{bail, eyre, Context};


+ 1
- 6
examples/iceoryx/sink/src/main.rs View File

@@ -6,12 +6,7 @@ fn main() -> eyre::Result<()> {

let inputs = operator.inputs()?;

loop {
let input = match inputs.recv() {
Ok(input) => input,
Err(_) => break,
};

while let Ok(input) = inputs.recv() {
match input.id.as_str() {
"message" => {
let received_string = String::from_utf8(input.data)


+ 1
- 6
examples/rust-dataflow/sink/src/main.rs View File

@@ -6,12 +6,7 @@ fn main() -> eyre::Result<()> {

let inputs = operator.inputs()?;

loop {
let input = match inputs.recv() {
Ok(input) => input,
Err(_) => break,
};

while let Ok(input) = inputs.recv() {
match input.id.as_str() {
"message" => {
let received_string = String::from_utf8(input.data)


Loading…
Cancel
Save