| @@ -87,10 +87,6 @@ mod ffi { | |||
| } | |||
| } | |||
| mod arrow_ffi { | |||
| pub use arrow::ffi::{FFI_ArrowArray, FFI_ArrowSchema}; | |||
| } | |||
| #[cfg(feature = "ros2-bridge")] | |||
| pub mod ros2 { | |||
| pub use dora_ros2_bridge::*; | |||
| @@ -215,7 +211,7 @@ unsafe fn event_as_arrow_input( | |||
| } | |||
| } | |||
| Err(e) => ffi::DoraResult { | |||
| error: format!("Error exporting Arrow array to C++: {:?}", e), | |||
| error: format!("Error exporting Arrow array to C++: {e:?}"), | |||
| }, | |||
| } | |||
| } | |||
| @@ -276,7 +272,7 @@ unsafe fn send_arrow_output( | |||
| } | |||
| } | |||
| Err(e) => ffi::DoraResult { | |||
| error: format!("Error importing array from C++: {:?}", e), | |||
| error: format!("Error importing array from C++: {e:?}"), | |||
| }, | |||
| } | |||
| } | |||
| @@ -320,6 +320,7 @@ impl Events { | |||
| } | |||
| } | |||
| #[allow(clippy::large_enum_variant)] | |||
| enum EventsInner { | |||
| Dora(EventStream), | |||
| Merged(Box<dyn Stream<Item = MergedEvent<PyObject>> + Unpin + Send + Sync>), | |||
| @@ -214,25 +214,13 @@ pub fn pydict_to_metadata(dict: Option<Bound<'_, PyDict>>) -> Result<MetadataPar | |||
| parameters.insert(key, Parameter::Float(value.extract::<f64>()?)) | |||
| } else if value.is_instance_of::<PyString>() { | |||
| parameters.insert(key, Parameter::String(value.extract()?)) | |||
| } else if value.is_instance_of::<PyTuple>() | |||
| } else if (value.is_instance_of::<PyTuple>() || value.is_instance_of::<PyList>()) | |||
| && value.len()? > 0 | |||
| && value.get_item(0)?.is_exact_instance_of::<PyInt>() | |||
| { | |||
| let list: Vec<i64> = value.extract()?; | |||
| parameters.insert(key, Parameter::ListInt(list)) | |||
| } else if value.is_instance_of::<PyList>() | |||
| && value.len()? > 0 | |||
| && value.get_item(0)?.is_exact_instance_of::<PyInt>() | |||
| { | |||
| let list: Vec<i64> = value.extract()?; | |||
| parameters.insert(key, Parameter::ListInt(list)) | |||
| } else if value.is_instance_of::<PyTuple>() | |||
| && value.len()? > 0 | |||
| && value.get_item(0)?.is_exact_instance_of::<PyFloat>() | |||
| { | |||
| let list: Vec<f64> = value.extract()?; | |||
| parameters.insert(key, Parameter::ListFloat(list)) | |||
| } else if value.is_instance_of::<PyList>() | |||
| } else if (value.is_instance_of::<PyTuple>() || value.is_instance_of::<PyList>()) | |||
| && value.len()? > 0 | |||
| && value.get_item(0)?.is_exact_instance_of::<PyFloat>() | |||
| { | |||
| @@ -8,6 +8,7 @@ use futures_concurrency::stream::Merge; | |||
| /// A Dora event or an event from an external source. | |||
| #[derive(Debug)] | |||
| #[allow(clippy::large_enum_variant)] | |||
| pub enum MergedEvent<E> { | |||
| /// A Dora event | |||
| Dora(super::Event), | |||
| @@ -55,25 +55,24 @@ impl Executable for SelfSubCommand { | |||
| ); | |||
| } else { | |||
| println!( | |||
| "Dora CLI is already at the latest version: {}", | |||
| current_version | |||
| "Dora CLI is already at the latest version: {current_version}" | |||
| ); | |||
| } | |||
| } | |||
| Err(e) => println!("Failed to check for updates: {}", e), | |||
| Err(e) => println!("Failed to check for updates: {e}"), | |||
| } | |||
| } else { | |||
| // Perform the actual update | |||
| match status.update() { | |||
| Ok(update_status) => match update_status { | |||
| self_update::Status::UpToDate(version) => { | |||
| println!("Dora CLI is already at the latest version: {}", version); | |||
| println!("Dora CLI is already at the latest version: {version}"); | |||
| } | |||
| self_update::Status::Updated(version) => { | |||
| println!("Successfully updated Dora CLI to version: {}", version); | |||
| println!("Successfully updated Dora CLI to version: {version}"); | |||
| } | |||
| }, | |||
| Err(e) => println!("Failed to update: {}", e), | |||
| Err(e) => println!("Failed to update: {e}"), | |||
| } | |||
| } | |||
| } | |||
| @@ -1070,7 +1070,7 @@ impl Daemon { | |||
| for task in tasks { | |||
| let NodeBuildTask { | |||
| node_id, | |||
| dynamic_node, | |||
| dynamic_node: _, | |||
| task, | |||
| } = task; | |||
| let node = task | |||
| @@ -2680,6 +2680,7 @@ impl Event { | |||
| } | |||
| #[derive(Debug)] | |||
| #[allow(clippy::large_enum_variant)] | |||
| pub enum DaemonNodeEvent { | |||
| OutputsDone { | |||
| reply_sender: oneshot::Sender<DaemonReply>, | |||
| @@ -416,7 +416,7 @@ struct Indent<'a>(&'a str); | |||
| impl std::fmt::Display for Indent<'_> { | |||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | |||
| for line in self.0.lines() { | |||
| write!(f, " {}", line)?; | |||
| write!(f, " {line}")?; | |||
| } | |||
| Ok(()) | |||
| } | |||
| @@ -152,7 +152,7 @@ pub async fn spawn_listener_loop( | |||
| if !tmpfile_dir.exists() { | |||
| std::fs::create_dir_all(&tmpfile_dir).context("could not create tmp dir")?; | |||
| } | |||
| let socket_file = tmpfile_dir.join(format!("{}.sock", node_id)); | |||
| let socket_file = tmpfile_dir.join(format!("{node_id}.sock")); | |||
| let socket = match UnixListener::bind(&socket_file) { | |||
| Ok(socket) => socket, | |||
| Err(err) => { | |||
| @@ -42,6 +42,7 @@ pub async fn listener_loop( | |||
| Listener::run(connection, daemon_tx, clock).await | |||
| } | |||
| #[allow(clippy::large_enum_variant)] | |||
| enum Operation { | |||
| Receive(oneshot::Sender<eyre::Result<Option<Timestamped<DaemonRequest>>>>), | |||
| Send { | |||
| @@ -633,7 +633,7 @@ async fn path_spawn_command( | |||
| .wrap_err("failed to download custom node")? | |||
| } else { | |||
| resolve_path(source, working_dir) | |||
| .wrap_err_with(|| format!("failed to resolve node source `{}`", source))? | |||
| .wrap_err_with(|| format!("failed to resolve node source `{source}`"))? | |||
| }; | |||
| // If extension is .py, use python to run the script | |||
| @@ -34,7 +34,7 @@ fn main() -> eyre::Result<()> { | |||
| for data in &data { | |||
| for _ in 0..1 { | |||
| node.send_output_raw(latency.clone(), Default::default(), data.len(), |out| { | |||
| out.copy_from_slice(&data); | |||
| out.copy_from_slice(data); | |||
| })?; | |||
| // sleep a bit to avoid queue buildup | |||
| @@ -49,7 +49,7 @@ fn main() -> eyre::Result<()> { | |||
| for data in &data { | |||
| for _ in 0..100 { | |||
| node.send_output_raw(throughput.clone(), Default::default(), data.len(), |out| { | |||
| out.copy_from_slice(&data); | |||
| out.copy_from_slice(data); | |||
| })?; | |||
| } | |||
| // notify sink that all messages have been sent | |||
| @@ -14,7 +14,7 @@ fn main() -> eyre::Result<()> { | |||
| "message" => { | |||
| let received_string: &str = | |||
| TryFrom::try_from(&data).context("expected string message")?; | |||
| println!("sink received message: {}", received_string); | |||
| println!("sink received message: {received_string}"); | |||
| if !received_string.starts_with("operator received random value ") { | |||
| bail!("unexpected message format (should start with 'operator received random value')") | |||
| } | |||
| @@ -15,7 +15,7 @@ fn main() -> eyre::Result<()> { | |||
| "message" => { | |||
| let received_string: &str = | |||
| TryFrom::try_from(&data).context("expected string message")?; | |||
| println!("sink received message: {}", received_string); | |||
| println!("sink received message: {received_string}"); | |||
| if !received_string.starts_with("operator received random value ") { | |||
| bail!("unexpected message format (should start with 'operator received random value')") | |||
| } | |||
| @@ -14,7 +14,7 @@ fn main() -> eyre::Result<()> { | |||
| "message" => { | |||
| let received_string: &str = | |||
| TryFrom::try_from(&data).context("expected string message")?; | |||
| println!("sink received message: {}", received_string); | |||
| println!("sink received message: {received_string}"); | |||
| if !received_string.starts_with("operator received random value ") { | |||
| bail!("unexpected message format (should start with 'operator received random value')") | |||
| } | |||
| @@ -17,10 +17,8 @@ fn main() -> eyre::Result<()> { | |||
| "random" => { | |||
| let value = u64::try_from(&data).context("unexpected data type")?; | |||
| let output = format!( | |||
| "operator received random value {value:#x} after {} ticks", | |||
| ticks | |||
| ); | |||
| let output = | |||
| format!("operator received random value {value:#x} after {ticks} ticks"); | |||
| node.send_output( | |||
| status_output.clone(), | |||
| metadata.parameters, | |||
| @@ -21,10 +21,7 @@ impl ZenohCommunicationLayer { | |||
| /// and [`subscriber`][Self::subscribe] methods. Pass an empty string if no prefix is | |||
| /// desired. | |||
| pub fn init(config: Config, prefix: String) -> Result<Self, BoxError> { | |||
| let zenoh = ::zenoh::open(config) | |||
| .res_sync() | |||
| .map_err(BoxError::from)? | |||
| .into_arc(); | |||
| let zenoh = ::zenoh::open(config).res_sync()?.into_arc(); | |||
| Ok(Self { | |||
| zenoh, | |||
| topic_prefix: prefix, | |||
| @@ -43,8 +40,7 @@ impl CommunicationLayer for ZenohCommunicationLayer { | |||
| .declare_publisher(self.prefixed(topic)) | |||
| .congestion_control(CongestionControl::Block) | |||
| .priority(Priority::RealTime) | |||
| .res_sync() | |||
| .map_err(BoxError::from)?; | |||
| .res_sync()?; | |||
| Ok(Box::new(ZenohPublisher { publisher })) | |||
| } | |||
| @@ -54,8 +50,7 @@ impl CommunicationLayer for ZenohCommunicationLayer { | |||
| .zenoh | |||
| .declare_subscriber(self.prefixed(topic)) | |||
| .reliable() | |||
| .res_sync() | |||
| .map_err(BoxError::from)?; | |||
| .res_sync()?; | |||
| Ok(Box::new(ZenohReceiver(subscriber))) | |||
| } | |||
| @@ -102,10 +97,7 @@ impl<'a> crate::PublishSample<'a> for ZenohPublishSample { | |||
| } | |||
| fn publish(self: Box<Self>) -> Result<(), BoxError> { | |||
| self.publisher | |||
| .put(self.sample) | |||
| .res_sync() | |||
| .map_err(BoxError::from) | |||
| self.publisher.put(self.sample).res_sync() | |||
| } | |||
| } | |||
| @@ -15,7 +15,7 @@ pub struct GitManager { | |||
| pub clones_in_use: BTreeMap<PathBuf, BTreeSet<DataflowId>>, | |||
| /// Builds that are prepared, but not done yet. | |||
| prepared_builds: BTreeMap<SessionId, PreparedBuild>, | |||
| reuse_for: BTreeMap<PathBuf, PathBuf>, | |||
| // reuse_for: BTreeMap<PathBuf, PathBuf>, | |||
| } | |||
| #[derive(Default)] | |||
| @@ -8,6 +8,11 @@ use eyre::Context; | |||
| pub trait ArrowTypeInfoExt { | |||
| fn empty() -> Self; | |||
| fn byte_array(data_len: usize) -> Self; | |||
| /// # Safety | |||
| /// | |||
| /// This function assumes that the `ArrayData` is backed by a memory region that starts at `region_start` | |||
| /// and has a length of `region_len`. It will panic if the `ArrayData` does not conform to this assumption. | |||
| unsafe fn from_array( | |||
| array: &ArrayData, | |||
| region_start: *const u8, | |||
| @@ -40,17 +40,17 @@ fn parse_action_string(pkg_name: &str, action_name: &str, action_string: &str) - | |||
| name: action_name.into(), | |||
| goal: parse_message_string( | |||
| pkg_name, | |||
| &format!("{}{}", action_name, ACTION_GOAL_SUFFIX), | |||
| &format!("{action_name}{ACTION_GOAL_SUFFIX}"), | |||
| action_blocks[0], | |||
| )?, | |||
| result: parse_message_string( | |||
| pkg_name, | |||
| &format!("{}{}", action_name, ACTION_RESULT_SUFFIX), | |||
| &format!("{action_name}{ACTION_RESULT_SUFFIX}"), | |||
| action_blocks[1], | |||
| )?, | |||
| feedback: parse_message_string( | |||
| pkg_name, | |||
| &format!("{}{}", action_name, ACTION_FEEDBACK_SUFFIX), | |||
| &format!("{action_name}{ACTION_FEEDBACK_SUFFIX}"), | |||
| action_blocks[2], | |||
| )?, | |||
| }) | |||
| @@ -18,11 +18,9 @@ fn nestable_type_default(nestable_type: NestableType, default: &str) -> Result<V | |||
| ensure!(rest.is_empty()); | |||
| Ok(vec![default]) | |||
| } | |||
| NestableType::NamedType(t) => { | |||
| Err(RclMsgError::InvalidDefaultError(format!("{}", t)).into()) | |||
| } | |||
| NestableType::NamedType(t) => Err(RclMsgError::InvalidDefaultError(format!("{t}")).into()), | |||
| NestableType::NamespacedType(t) => { | |||
| Err(RclMsgError::InvalidDefaultError(format!("{}", t)).into()) | |||
| Err(RclMsgError::InvalidDefaultError(format!("{t}")).into()) | |||
| } | |||
| NestableType::GenericString(t) => { | |||
| let (rest, default) = literal::get_string_literal_parser(t)(default) | |||
| @@ -41,11 +39,9 @@ fn array_type_default(value_type: NestableType, default: &str) -> Result<Vec<Str | |||
| ensure!(rest.is_empty()); | |||
| Ok(default) | |||
| } | |||
| NestableType::NamedType(t) => { | |||
| Err(RclMsgError::InvalidDefaultError(format!("{}", t)).into()) | |||
| } | |||
| NestableType::NamedType(t) => Err(RclMsgError::InvalidDefaultError(format!("{t}")).into()), | |||
| NestableType::NamespacedType(t) => { | |||
| Err(RclMsgError::InvalidDefaultError(format!("{}", t)).into()) | |||
| Err(RclMsgError::InvalidDefaultError(format!("{t}")).into()) | |||
| } | |||
| NestableType::GenericString(_) => { | |||
| let (rest, default) = literal::string_literal_sequence(default) | |||
| @@ -39,12 +39,12 @@ fn parse_service_string(pkg_name: &str, srv_name: &str, service_string: &str) -> | |||
| name: srv_name.into(), | |||
| request: parse_message_string( | |||
| pkg_name, | |||
| &format!("{}{}", srv_name, SERVICE_REQUEST_SUFFIX), | |||
| &format!("{srv_name}{SERVICE_REQUEST_SUFFIX}"), | |||
| service_blocks[0], | |||
| )?, | |||
| response: parse_message_string( | |||
| pkg_name, | |||
| &format!("{}{}", srv_name, SERVICE_RESPONSE_SUFFIX), | |||
| &format!("{srv_name}{SERVICE_RESPONSE_SUFFIX}"), | |||
| service_blocks[1], | |||
| )?, | |||
| }) | |||
| @@ -97,7 +97,7 @@ impl Action { | |||
| let request = Message { | |||
| package: self.package.clone(), | |||
| name: format!("{}_Request", common), | |||
| name: format!("{common}_Request"), | |||
| members: vec![ | |||
| goal_id_type(), | |||
| Member { | |||
| @@ -115,7 +115,7 @@ impl Action { | |||
| }; | |||
| let response = Message { | |||
| package: self.package.clone(), | |||
| name: format!("{}_Response", common), | |||
| name: format!("{common}_Response"), | |||
| members: vec![ | |||
| Member { | |||
| name: "accepted".into(), | |||
| @@ -149,13 +149,13 @@ impl Action { | |||
| let request = Message { | |||
| package: self.package.clone(), | |||
| name: format!("{}_Request", common), | |||
| name: format!("{common}_Request"), | |||
| members: vec![goal_id_type()], | |||
| constants: vec![], | |||
| }; | |||
| let response = Message { | |||
| package: self.package.clone(), | |||
| name: format!("{}_Response", common), | |||
| name: format!("{common}_Response"), | |||
| members: vec![ | |||
| Member { | |||
| name: "status".into(), | |||
| @@ -7,6 +7,7 @@ use crate::{ | |||
| }; | |||
| #[derive(Debug, serde::Deserialize, serde::Serialize)] | |||
| #[allow(clippy::large_enum_variant)] | |||
| pub enum InterDaemonEvent { | |||
| Output { | |||
| dataflow_id: DataflowId, | |||
| @@ -46,6 +46,7 @@ pub enum DaemonCommunication { | |||
| #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] | |||
| #[must_use] | |||
| #[allow(clippy::large_enum_variant)] | |||
| pub enum DaemonReply { | |||
| Result(Result<(), String>), | |||
| PreparedMessage { shared_memory_id: SharedMemoryId }, | |||
| @@ -56,6 +57,7 @@ pub enum DaemonReply { | |||
| } | |||
| #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] | |||
| #[allow(clippy::large_enum_variant)] | |||
| pub enum NodeEvent { | |||
| Stop, | |||
| Reload { | |||
| @@ -108,6 +108,7 @@ pub struct ResolvedNode { | |||
| #[derive(Debug, Clone, Serialize, Deserialize)] | |||
| #[serde(rename_all = "lowercase")] | |||
| #[allow(clippy::large_enum_variant)] | |||
| pub enum CoreNodeKind { | |||
| /// Dora runtime node | |||
| #[serde(rename = "operators")] | |||
| @@ -72,12 +72,12 @@ pub fn lib_main() -> Result<()> { | |||
| .map(|s| s.as_str()) | |||
| .unwrap_or("av1"); | |||
| if encoding != "av1" { | |||
| warn!("Unsupported encoding {}", encoding); | |||
| warn!("Unsupported encoding {encoding}"); | |||
| continue; | |||
| } | |||
| match dec.send_data(data, None, None, None) { | |||
| Err(e) => { | |||
| warn!("Error sending data to the decoder: {}", e); | |||
| warn!("Error sending data to the decoder: {e}"); | |||
| } | |||
| Ok(()) => { | |||
| if let Ok(p) = dec.get_picture() { | |||
| @@ -136,8 +136,7 @@ pub fn lib_main() -> Result<()> { | |||
| } | |||
| _ => { | |||
| warn!( | |||
| "Unsupported output encoding {}", | |||
| output_encoding | |||
| "Unsupported output encoding {output_encoding}" | |||
| ); | |||
| continue; | |||
| } | |||
| @@ -32,7 +32,7 @@ pub fn lib_main() -> eyre::Result<()> { | |||
| let mut com = serial::open(&serial_port).wrap_err(Error::Connect(serial_port))?; | |||
| com.configure(&COM_SETTINGS) | |||
| .wrap_err(Error::SettingsSet(format!("{:?}", COM_SETTINGS)))?; | |||
| .wrap_err(Error::SettingsSet(format!("{COM_SETTINGS:?}")))?; | |||
| com.set_timeout(Duration::from_millis(1000)) | |||
| .wrap_err(Error::SetTimeout("1000ms".to_string()))?; | |||
| @@ -13,7 +13,7 @@ async fn main() -> eyre::Result<()> { | |||
| .with_logging() | |||
| .build() | |||
| .await | |||
| .map_err(|e| Report::msg(format!("Model Build error: {}", e))) // Convert error | |||
| .map_err(|e| Report::msg(format!("Model Build error: {e}"))) // Convert error | |||
| .expect("Failed to build model"); | |||
| while let Some(event) = events.recv_async().await { | |||
| @@ -33,7 +33,7 @@ async fn main() -> eyre::Result<()> { | |||
| let response = model | |||
| .send_chat_request(messages) | |||
| .await | |||
| .map_err(|e| Report::msg(format!("Model Response error: {}", e))) // Convert error | |||
| .map_err(|e| Report::msg(format!("Model Response error: {e}"))) // Convert error | |||
| .expect("Failed to get response from model"); | |||
| let output = response.choices[0].message.content.as_ref().unwrap(); | |||
| @@ -76,7 +76,7 @@ fn metadata_to_exif(metadata: &MetadataParameters) -> Result<Vec<u8>> { | |||
| } | |||
| let vector = metadata_exif.as_u8_vec(little_exif::filetype::FileExtension::HEIF)?; | |||
| return Ok(vector); | |||
| Ok(vector) | |||
| } | |||
| fn bgr8_to_yuv420(bgr_data: Vec<u8>, width: usize, height: usize) -> (Vec<u8>, Vec<u8>, Vec<u8>) { | |||
| @@ -79,7 +79,7 @@ async fn main() -> eyre::Result<()> { | |||
| if let Err(e) = | |||
| write_event(&mut writer, data, &metadata, schema.clone()).await | |||
| { | |||
| println!("Error writing event data into parquet file: {:?}", e) | |||
| println!("Error writing event data into parquet file: {e:?}") | |||
| }; | |||
| } | |||
| writer.close().await | |||
| @@ -101,7 +101,7 @@ async fn main() -> eyre::Result<()> { | |||
| Some(tx) => drop(tx), | |||
| }, | |||
| Event::Error(err) => { | |||
| println!("Error: {}", err); | |||
| println!("Error: {err}"); | |||
| } | |||
| event => { | |||
| println!("Event: {event:#?}") | |||
| @@ -147,7 +147,7 @@ pub fn update_boxes2d( | |||
| }); | |||
| } | |||
| if values.len() == 0 { | |||
| if values.is_empty() { | |||
| rec.log(id.as_str(), &rerun::Clear::flat()) | |||
| .wrap_err("Could not log Boxes2D")?; | |||
| return Ok(()); | |||
| @@ -178,7 +178,7 @@ pub fn update_boxes2d( | |||
| }); | |||
| } | |||
| if values.len() == 0 { | |||
| if values.is_empty() { | |||
| rec.log(id.as_str(), &rerun::Clear::flat()) | |||
| .wrap_err("Could not log Boxes2D")?; | |||
| return Ok(()); | |||
| @@ -209,7 +209,7 @@ pub fn update_boxes2d( | |||
| }); | |||
| } | |||
| if values.len() == 0 { | |||
| if values.is_empty() { | |||
| rec.log(id.as_str(), &rerun::Clear::flat()) | |||
| .wrap_err("Could not log Boxes2D")?; | |||
| return Ok(()); | |||
| @@ -239,7 +239,7 @@ pub fn update_boxes2d( | |||
| } | |||
| }); | |||
| } | |||
| if values.len() == 0 { | |||
| if values.is_empty() { | |||
| rec.log(id.as_str(), &rerun::Clear::flat()) | |||
| .wrap_err("Could not log Boxes2D")?; | |||
| return Ok(()); | |||
| @@ -76,7 +76,7 @@ pub fn lib_main() -> Result<()> { | |||
| let id = node.dataflow_id(); | |||
| let path = Path::new("out") | |||
| .join(id.to_string()) | |||
| .join(format!("archive-{}.rerun", id)); | |||
| .join(format!("archive-{id}.rerun")); | |||
| rerun::RecordingStreamBuilder::new("dora-rerun") | |||
| .save(path) | |||
| @@ -368,7 +368,7 @@ pub fn lib_main() -> Result<()> { | |||
| "jointstate" | |||
| }; | |||
| if encoding != "jointstate" { | |||
| warn!("Got unexpected encoding: {} on position pose", encoding); | |||
| warn!("Got unexpected encoding: {encoding} on position pose"); | |||
| continue; | |||
| } | |||
| // Convert to Vec<f32> | |||
| @@ -386,6 +386,7 @@ pub fn lib_main() -> Result<()> { | |||
| if dof < positions.len() { | |||
| positions.truncate(dof); | |||
| } else { | |||
| #[allow(clippy::same_item_push)] | |||
| for _ in 0..(dof - positions.len()) { | |||
| positions.push(0.); | |||
| } | |||
| @@ -393,7 +394,7 @@ pub fn lib_main() -> Result<()> { | |||
| update_visualization(&rec, chain, &id, &positions)?; | |||
| } else { | |||
| println!("Could not find chain for {}. You may not have set its", id); | |||
| println!("Could not find chain for {id}. You may not have set its"); | |||
| } | |||
| } else if id.as_str().contains("series") { | |||
| update_series(&rec, id, data).context("could not plot series")?; | |||
| @@ -452,7 +453,7 @@ pub fn lib_main() -> Result<()> { | |||
| .context("could not log points")?; | |||
| } | |||
| } else { | |||
| println!("Could not find handler for {}", id); | |||
| println!("Could not find handler for {id}"); | |||
| } | |||
| } | |||
| } | |||
| @@ -82,7 +82,7 @@ pub fn init_urdf(rec: &RecordingStream) -> Result<HashMap<String, Chain<f32>>> { | |||
| PathBuf::from(urdf_path) | |||
| }; | |||
| let chain = k::Chain::<f32>::from_urdf_file(&urdf_path) | |||
| .context(format!("Could not load URDF {:#?}", urdf_path))?; | |||
| .context(format!("Could not load URDF {urdf_path:#?}"))?; | |||
| let path = key.replace("_urdf", ".urdf").replace("_URDF", ".urdf"); | |||
| let transform = key.replace("_urdf", "_transform"); | |||
| @@ -94,10 +94,9 @@ pub fn init_urdf(rec: &RecordingStream) -> Result<HashMap<String, Chain<f32>>> { | |||
| } | |||
| rec.log_file_from_path(&urdf_path, None, true) | |||
| .context(format!( | |||
| "Could not log URDF file {:#?} within rerun-urdf-loader", | |||
| urdf_path | |||
| "Could not log URDF file {urdf_path:#?} within rerun-urdf-loader" | |||
| ))?; | |||
| println!("Logging URDF file: {:#?}", urdf_path); | |||
| println!("Logging URDF file: {urdf_path:#?}"); | |||
| // Get transform by replacing URDF_ with TRANSFORM_ | |||
| if let Ok(transform) = std::env::var(transform) { | |||
| @@ -320,7 +320,7 @@ async fn chat_completions_handler( | |||
| let body_bytes = match to_bytes(req.body_mut()).await { | |||
| Ok(body_bytes) => body_bytes, | |||
| Err(e) => { | |||
| let err_msg = format!("Fail to read buffer from request body. {}", e); | |||
| let err_msg = format!("Fail to read buffer from request body. {e}"); | |||
| // log | |||
| error!(target: "stdout", "{}", &err_msg); | |||
| @@ -331,10 +331,10 @@ async fn chat_completions_handler( | |||
| let mut chat_request: ChatCompletionRequest = match serde_json::from_slice(&body_bytes) { | |||
| Ok(chat_request) => chat_request, | |||
| Err(e) => { | |||
| let mut err_msg = format!("Fail to deserialize chat completion request: {}.", e); | |||
| let mut err_msg = format!("Fail to deserialize chat completion request: {e}."); | |||
| if let Ok(json_value) = serde_json::from_slice::<serde_json::Value>(&body_bytes) { | |||
| err_msg = format!("{}\njson_value: {}", err_msg, json_value); | |||
| err_msg = format!("{err_msg}\njson_value: {json_value}"); | |||
| } | |||
| // log | |||
| @@ -393,7 +393,7 @@ async fn chat_completions_handler( | |||
| response | |||
| } | |||
| Err(e) => { | |||
| let err_msg = format!("Failed chat completions in stream mode. Reason: {}", e); | |||
| let err_msg = format!("Failed chat completions in stream mode. Reason: {e}"); | |||
| // log | |||
| error!(target: "stdout", "{}", &err_msg); | |||
| @@ -411,7 +411,7 @@ async fn chat_completions_handler( | |||
| let s = match serde_json::to_string(&chat_completion_object) { | |||
| Ok(s) => s, | |||
| Err(e) => { | |||
| let err_msg = format!("Failed to serialize chat completion object. {}", e); | |||
| let err_msg = format!("Failed to serialize chat completion object. {e}"); | |||
| // log | |||
| error!(target: "stdout", "{}", &err_msg); | |||
| @@ -438,7 +438,7 @@ async fn chat_completions_handler( | |||
| } | |||
| Err(e) => { | |||
| let err_msg = | |||
| format!("Failed chat completions in non-stream mode. Reason: {}", e); | |||
| format!("Failed chat completions in non-stream mode. Reason: {e}"); | |||
| // log | |||
| error!(target: "stdout", "{}", &err_msg); | |||
| @@ -448,7 +448,7 @@ async fn chat_completions_handler( | |||
| } | |||
| } | |||
| Err(e) => { | |||
| let err_msg = format!("Failed to get chat completions. Reason: {}", e); | |||
| let err_msg = format!("Failed to get chat completions. Reason: {e}"); | |||
| // log | |||
| error!(target: "stdout", "{}", &err_msg); | |||
| @@ -19,10 +19,10 @@ fn main() -> eyre::Result<()> { | |||
| dora_node_api::arrow::datatypes::DataType::Utf8 => { | |||
| let received_string: &str = | |||
| TryFrom::try_from(&data).context("expected string message")?; | |||
| println!("Received id: {}, data: {}", id, received_string); | |||
| println!("Received id: {id}, data: {received_string}"); | |||
| } | |||
| _other => { | |||
| println!("Received id: {}, data: {:#?}", id, data); | |||
| println!("Received id: {id}, data: {data:#?}"); | |||
| } | |||
| }, | |||
| _other => {} | |||
| @@ -33,7 +33,7 @@ fn main() -> eyre::Result<()> { | |||
| } | |||
| Err(err) => { | |||
| if err.to_string() == printed_error { | |||
| println!("{:#?}", err); | |||
| println!("{err:#?}"); | |||
| println!("🕐 waiting for node `terminal-print` to be available..."); | |||
| printed_error = err.to_string(); | |||
| } | |||
| @@ -26,7 +26,7 @@ fn main() -> eyre::Result<()> { | |||
| let _time: u64 = data.values()[0]; | |||
| let time_metadata = metadata.timestamp(); | |||
| let duration_metadata = time_metadata.get_time().to_system_time().elapsed()?; | |||
| println!("Latency duration: {:?}", duration_metadata); | |||
| println!("Latency duration: {duration_metadata:?}"); | |||
| assert!( | |||
| duration_metadata < Duration::from_millis(500), | |||
| "Time difference should be less than 500ms" | |||