Skip to content

Commit

Permalink
Fix new lints
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser committed Aug 18, 2024
1 parent 932534d commit 4e5240d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/api/image_array/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl Response for ASCOMResult<ImageArray> {
.map(|response| response.map(|response| response.map(|json| json.0)));
}
let metadata = bytes
.get(..std::mem::size_of::<ImageBytesMetadata>())
.get(..size_of::<ImageBytesMetadata>())
.ok_or_else(|| eyre::eyre!("not enough bytes to read image metadata"))?;
let metadata = bytemuck::pod_read_unaligned::<ImageBytesMetadata>(metadata);
eyre::ensure!(
Expand All @@ -107,7 +107,7 @@ impl Response for ASCOMResult<ImageArray> {
);
let data_start = usize::try_from(metadata.data_start)?;
eyre::ensure!(
data_start >= std::mem::size_of::<ImageBytesMetadata>(),
data_start >= size_of::<ImageBytesMetadata>(),
"image data start offset is within metadata",
);
let data = bytes
Expand Down
2 changes: 1 addition & 1 deletion src/api/image_array/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl ImageArray {
.iter()
.filter_map(|value| value.to_str().ok())
.flat_map(MediaTypeList::new)
.filter_map(std::result::Result::ok)
.filter_map(Result::ok)
.any(|media_type| media_type.essence() == MEDIA_TYPE)
}
}
7 changes: 3 additions & 4 deletions src/client/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct BoundClient {
impl BoundClient {
#[tracing::instrument(level = "trace", skip_all, fields(%addr, intf.friendly_name = intf.friendly_name.as_ref(), intf.description = intf.description.as_ref(), ?intf.ipv4, ?intf.ipv6))]
async fn send_discovery_msg(&self, addr: Ipv6Addr, intf: &Interface) {
match async {
let send_op = async {
if addr.is_multicast() {
socket2::SockRef::from(&self.socket).set_multicast_if_v6(intf.index)?;
}
Expand All @@ -52,9 +52,8 @@ impl BoundClient {
.send_to(DISCOVERY_MSG, (addr, self.client.discovery_port))
.await?;
Ok::<_, std::io::Error>(())
}
.await
{
};
match send_op.await {
Ok(()) => tracing::trace!("success"),
Err(err) => tracing::warn!(%err),
}
Expand Down
2 changes: 1 addition & 1 deletion src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub(crate) async fn bind_socket(
socket.as_raw_socket() as _,
SIO_UDP_CONNRESET,
std::ptr::addr_of!(input).cast(),
std::mem::size_of_val(&input) as _,
size_of_val(&input) as _,
std::ptr::null_mut(),
0,
std::ptr::addr_of_mut!(output).cast(),
Expand Down
2 changes: 1 addition & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ macro_rules! ascom_error_codes {
}

ascom_error_codes! {
#[doc = ""]
#[doc = "Success"]
OK = 0,
#[doc = "The requested action is not implemented in this driver"]
ACTION_NOT_IMPLEMENTED = 0x40C,
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ Licensed under either of
unused_macro_rules,
unused_qualifications,
unused_results,
unused_tuple_struct_fields
dead_code
)]
#![allow(
clippy::module_name_repetitions,
Expand Down Expand Up @@ -377,7 +377,9 @@ pub use server::{BoundServer, Server};
fn prepare_test_env() {
use tracing_subscriber::prelude::*;

std::env::set_var("RUST_BACKTRACE", "full");
unsafe {
std::env::set_var("RUST_BACKTRACE", "full");
}

tracing_subscriber::registry()
.with(
Expand Down

0 comments on commit 4e5240d

Please sign in to comment.