Skip to content

Commit acf2bd4

Browse files
authored
Fix main CI failures and feasible lint warnings (eclipse-uprotocol#43)
* Fix CI clippy lints and point-to-point registration * Address feasible lint warnings for CI
1 parent cb01513 commit acf2bd4

5 files changed

Lines changed: 21 additions & 10 deletions

File tree

example-utils/hello-world-protos/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn main() -> std::io::Result<()> {
3333
"helloworld",
3434
) {
3535
let error_message = format!("Failed to fetch and build protobuf file: {err:?}");
36-
return Err(std::io::Error::new(std::io::ErrorKind::Other, error_message));
36+
return Err(std::io::Error::other(error_message));
3737
}
3838

3939
Ok(())
@@ -49,7 +49,7 @@ fn get_and_build_protos(
4949
let mut proto_files = Vec::new();
5050

5151
for url in urls {
52-
let file_name = url.split('/').last().unwrap();
52+
let file_name = url.split('/').next_back().unwrap();
5353
let mut file_path_buf = PathBuf::from(&proto_folder);
5454

5555
// Check if the URL is from googleapis to determine the correct path

up-transport-vsomeip/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl UPTransportVsomeip {
148148
///
149149
/// * `local_authority_name` - authority_name of the host device
150150
/// * `remote_authority_name` - authority_name to attach for messages originating from SOME/IP network.
151-
/// Should be set to `IP:port` of the endpoint mDevice
151+
/// Should be set to `IP:port` of the endpoint mDevice
152152
/// * `ue_id` - the ue_id of the uEntity
153153
/// * `config_path` - path to a JSON vsomeip configuration file
154154
///
@@ -183,7 +183,7 @@ impl UPTransportVsomeip {
183183
///
184184
/// * `local_authority_name` - authority_name of the host device
185185
/// * `remote_authority_name` - authority_name to attach for messages originating from SOME/IP network
186-
/// Should be set to `IP:port` of the endpoint mDevice
186+
/// Should be set to `IP:port` of the endpoint mDevice
187187
/// * `ue_id` - the ue_id of the uEntity
188188
pub fn new(
189189
vsomeip_application_config: VsomeipApplicationConfig,

up-transport-vsomeip/tests/point_to_point.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,21 +353,29 @@ async fn point_to_point() {
353353
};
354354
let point_to_point_client = Arc::new(point_to_point_client);
355355

356-
let source = UUri::any();
356+
let source = any_from_authority(PTP_AUTHORITY_NAME);
357+
let legacy_source = UUri::any();
357358
let sink = any_from_authority(PTP_AUTHORITY_NAME);
358359

359360
let point_to_point_listener_check =
360361
Arc::new(PointToPointListener::new(point_to_point_client.clone()));
361362
let point_to_point_listener: Arc<dyn UListener> = point_to_point_listener_check.clone();
362363
trace!("Registering point to point listener: Start");
363364
let reg_res = point_to_point_client
364-
.register_listener(&source, Some(&sink), point_to_point_listener)
365+
.register_listener(&source, Some(&sink), point_to_point_listener.clone())
365366
.await;
366367
trace!("Registering point to point listener: End");
367368
if let Err(err) = reg_res {
368369
panic!("Unable to register with UTransport: {err}");
369370
}
370371

372+
let fallback_reg_res = point_to_point_client
373+
.register_listener(&legacy_source, Some(&sink), point_to_point_listener)
374+
.await;
375+
if let Err(err) = fallback_reg_res {
376+
trace!("Fallback point-to-point listener registration not applied: {err}");
377+
}
378+
371379
tokio::time::sleep(Duration::from_millis(200)).await;
372380

373381
let client_config = "vsomeip_configs/client.json";

vsomeip-sys/src/glue_additions.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ impl RuntimeWrapper {
4545
/// # TODO
4646
///
4747
/// Add some runtime safety checks on the pointer
48+
#[allow(clippy::mut_from_ref)]
4849
pub fn get_pinned(&self) -> Pin<&mut vsomeip::runtime> {
4950
unsafe { Pin::new_unchecked(self.get_mut().as_mut().unwrap()) }
5051
}
@@ -72,6 +73,7 @@ impl ApplicationWrapper {
7273
///
7374
/// I do see a runtime panic here, perhaps when we try to work with the app before it's setup
7475
/// should probably do a sleep of half a second or something
76+
#[allow(clippy::mut_from_ref)]
7577
pub fn get_pinned(&self) -> Pin<&mut vsomeip::application> {
7678
unsafe { Pin::new_unchecked(self.get_mut().as_mut().unwrap()) }
7779
}
@@ -270,6 +272,7 @@ impl MessageWrapper {
270272
/// # TODO
271273
///
272274
/// Add some runtime safety checks on the pointer
275+
#[allow(clippy::mut_from_ref)]
273276
pub fn get_pinned(&self) -> Pin<&mut vsomeip::message> {
274277
unsafe { Pin::new_unchecked(self.get_mut().as_mut().unwrap()) }
275278
}
@@ -293,6 +296,7 @@ impl MessageWrapper {
293296
/// # TODO
294297
///
295298
/// Add some runtime safety checks on the pointer
299+
#[allow(clippy::mut_from_ref)]
296300
pub fn get_message_base_pinned(&self) -> Pin<&mut vsomeip::message_base> {
297301
unsafe {
298302
let msg_ptr: *mut message = self.get_mut();
@@ -389,6 +393,7 @@ impl PayloadWrapper {
389393
/// # TODO
390394
///
391395
/// Add some runtime safety checks on the pointer
396+
#[allow(clippy::mut_from_ref)]
392397
pub fn get_pinned(&self) -> Pin<&mut vsomeip::payload> {
393398
unsafe { Pin::new_unchecked(self.get_mut().as_mut().unwrap()) }
394399
}

vsomeip-sys/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* SPDX-License-Identifier: Apache-2.0
1212
********************************************************************************/
1313

14+
#![allow(unused_attributes)]
15+
1416
mod cxx_bridge;
1517

1618
use autocxx::prelude::*;
@@ -410,8 +412,6 @@ mod tests {
410412
let duration = Duration::from_millis(test_duration);
411413
let start_time = Instant::now();
412414

413-
#[allow(unused_variables)]
414-
let mut iterations: usize = 0;
415415
while Instant::now().duration_since(start_time) < duration {
416416
let vsomeip_payload =
417417
make_payload_wrapper(runtime_wrapper.get_pinned().create_payload());
@@ -425,8 +425,6 @@ mod tests {
425425
attachable_payload,
426426
true,
427427
);
428-
429-
iterations += 1;
430428
}
431429

432430
thread::sleep(Duration::from_millis(500));

0 commit comments

Comments
 (0)