all clippy 1.67 fixes
This commit is contained in:
parent
81ba7c7e79
commit
4e361e4421
@ -153,10 +153,10 @@ impl Display for StoreIdError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
|
||||
match self {
|
||||
StoreIdError::InvalidSubpool(pool) => {
|
||||
write!(f, "invalid subpool, index: {}", pool)
|
||||
write!(f, "invalid subpool, index: {pool}")
|
||||
}
|
||||
StoreIdError::InvalidPacketIdx(packet_idx) => {
|
||||
write!(f, "invalid packet index: {}", packet_idx)
|
||||
write!(f, "invalid packet index: {packet_idx}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,19 +183,19 @@ impl Display for StoreError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
|
||||
match self {
|
||||
StoreError::DataTooLarge(size) => {
|
||||
write!(f, "data to store with size {} is too large", size)
|
||||
write!(f, "data to store with size {size} is too large")
|
||||
}
|
||||
StoreError::StoreFull(u16) => {
|
||||
write!(f, "store is too full. index for full subpool: {}", u16)
|
||||
write!(f, "store is too full. index for full subpool: {u16}")
|
||||
}
|
||||
StoreError::InvalidStoreId(id_e, addr) => {
|
||||
write!(f, "invalid store ID: {}, address: {:?}", id_e, addr)
|
||||
write!(f, "invalid store ID: {id_e}, address: {addr:?}")
|
||||
}
|
||||
StoreError::DataDoesNotExist(addr) => {
|
||||
write!(f, "no data exists at address {:?}", addr)
|
||||
write!(f, "no data exists at address {addr:?}")
|
||||
}
|
||||
StoreError::InternalError(e) => {
|
||||
write!(f, "internal error: {}", e)
|
||||
write!(f, "internal error: {e}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -330,14 +330,12 @@ impl LocalPool {
|
||||
fn write(&mut self, addr: &StoreAddr, data: &[u8]) -> Result<(), StoreError> {
|
||||
let packet_pos = self.raw_pos(addr).ok_or_else(|| {
|
||||
StoreError::InternalError(format!(
|
||||
"write: Error in raw_pos func with address {:?}",
|
||||
addr
|
||||
"write: Error in raw_pos func with address {addr:?}"
|
||||
))
|
||||
})?;
|
||||
let subpool = self.pool.get_mut(addr.pool_idx as usize).ok_or_else(|| {
|
||||
StoreError::InternalError(format!(
|
||||
"write: Error retrieving pool slice with address {:?}",
|
||||
addr
|
||||
"write: Error retrieving pool slice with address {addr:?}"
|
||||
))
|
||||
})?;
|
||||
let pool_slice = &mut subpool[packet_pos..packet_pos + data.len()];
|
||||
|
@ -522,9 +522,9 @@ impl VerificationReporterCore {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn send_acceptance_success<'src_data, E>(
|
||||
pub fn send_acceptance_success<E>(
|
||||
&self,
|
||||
mut sendable: VerificationSendable<'src_data, TcStateNone, VerifSuccess>,
|
||||
mut sendable: VerificationSendable<'_, TcStateNone, VerifSuccess>,
|
||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
||||
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
||||
) -> Result<VerificationToken<TcStateAccepted>, VerificationOrSendErrorWithToken<E, TcStateNone>>
|
||||
@ -535,9 +535,9 @@ impl VerificationReporterCore {
|
||||
Ok(sendable.send_success_acceptance_success(Some(seq_counter)))
|
||||
}
|
||||
|
||||
pub fn send_acceptance_failure<'src_data, E>(
|
||||
pub fn send_acceptance_failure<E>(
|
||||
&self,
|
||||
mut sendable: VerificationSendable<'src_data, TcStateNone, VerifFailure>,
|
||||
mut sendable: VerificationSendable<'_, TcStateNone, VerifFailure>,
|
||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
||||
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
||||
) -> Result<(), VerificationOrSendErrorWithToken<E, TcStateNone>> {
|
||||
@ -591,9 +591,9 @@ impl VerificationReporterCore {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn send_start_success<'src_data, E>(
|
||||
pub fn send_start_success<E>(
|
||||
&self,
|
||||
mut sendable: VerificationSendable<'src_data, TcStateAccepted, VerifSuccess>,
|
||||
mut sendable: VerificationSendable<'_, TcStateAccepted, VerifSuccess>,
|
||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
||||
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
||||
) -> Result<
|
||||
@ -630,9 +630,9 @@ impl VerificationReporterCore {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn send_start_failure<'src_data, E>(
|
||||
pub fn send_start_failure<E>(
|
||||
&self,
|
||||
mut sendable: VerificationSendable<'src_data, TcStateAccepted, VerifFailure>,
|
||||
mut sendable: VerificationSendable<'_, TcStateAccepted, VerifFailure>,
|
||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
||||
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
||||
) -> Result<(), VerificationOrSendErrorWithToken<E, TcStateAccepted>> {
|
||||
@ -741,9 +741,9 @@ impl VerificationReporterCore {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn send_step_or_completion_success<'src_data, E>(
|
||||
pub fn send_step_or_completion_success<E>(
|
||||
&self,
|
||||
mut sendable: VerificationSendable<'src_data, TcStateStarted, VerifSuccess>,
|
||||
mut sendable: VerificationSendable<'_, TcStateStarted, VerifSuccess>,
|
||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
||||
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
||||
) -> Result<(), VerificationOrSendErrorWithToken<E, TcStateStarted>> {
|
||||
@ -754,9 +754,9 @@ impl VerificationReporterCore {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn send_step_or_completion_failure<'src_data, E>(
|
||||
pub fn send_step_or_completion_failure<E>(
|
||||
&self,
|
||||
mut sendable: VerificationSendable<'src_data, TcStateStarted, VerifFailure>,
|
||||
mut sendable: VerificationSendable<'_, TcStateStarted, VerifFailure>,
|
||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
||||
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
||||
) -> Result<(), VerificationOrSendErrorWithToken<E, TcStateStarted>> {
|
||||
|
@ -14,16 +14,13 @@ fn main() {
|
||||
let pus_tc = PusTc::new_simple(&mut sph, 17, 1, None, true);
|
||||
let client = UdpSocket::bind("127.0.0.1:7302").expect("Connecting to UDP server failed");
|
||||
let tc_req_id = RequestId::new(&pus_tc);
|
||||
println!(
|
||||
"Packing and sending PUS ping command TC[17,1] with request ID {}",
|
||||
tc_req_id
|
||||
);
|
||||
println!("Packing and sending PUS ping command TC[17,1] with request ID {tc_req_id}");
|
||||
let size = pus_tc
|
||||
.write_to_bytes(&mut buf)
|
||||
.expect("Creating PUS TC failed");
|
||||
client
|
||||
.send_to(&buf[0..size], addr)
|
||||
.unwrap_or_else(|_| panic!("Sending to {:?} failed", addr));
|
||||
.unwrap_or_else(|_| panic!("Sending to {addr:?} failed"));
|
||||
client
|
||||
.set_read_timeout(Some(Duration::from_secs(2)))
|
||||
.expect("Setting read timeout failed");
|
||||
@ -44,33 +41,21 @@ fn main() {
|
||||
}
|
||||
let req_id = RequestId::from_bytes(src_data).unwrap();
|
||||
if pus_tm.subservice() == 1 {
|
||||
println!(
|
||||
"Received TM[1,1] acceptance success for request ID {}",
|
||||
req_id
|
||||
)
|
||||
println!("Received TM[1,1] acceptance success for request ID {req_id}")
|
||||
} else if pus_tm.subservice() == 2 {
|
||||
println!(
|
||||
"Received TM[1,2] acceptance failure for request ID {}",
|
||||
req_id
|
||||
)
|
||||
println!("Received TM[1,2] acceptance failure for request ID {req_id}")
|
||||
} else if pus_tm.subservice() == 3 {
|
||||
println!("Received TM[1,3] start success for request ID {}", req_id)
|
||||
println!("Received TM[1,3] start success for request ID {req_id}")
|
||||
} else if pus_tm.subservice() == 4 {
|
||||
println!("Received TM[1,2] start failure for request ID {}", req_id)
|
||||
println!("Received TM[1,2] start failure for request ID {req_id}")
|
||||
} else if pus_tm.subservice() == 5 {
|
||||
println!("Received TM[1,5] step success for request ID {}", req_id)
|
||||
println!("Received TM[1,5] step success for request ID {req_id}")
|
||||
} else if pus_tm.subservice() == 6 {
|
||||
println!("Received TM[1,6] step failure for request ID {}", req_id)
|
||||
println!("Received TM[1,6] step failure for request ID {req_id}")
|
||||
} else if pus_tm.subservice() == 7 {
|
||||
println!(
|
||||
"Received TM[1,7] completion success for request ID {}",
|
||||
req_id
|
||||
)
|
||||
println!("Received TM[1,7] completion success for request ID {req_id}")
|
||||
} else if pus_tm.subservice() == 8 {
|
||||
println!(
|
||||
"Received TM[1,8] completion failure for request ID {}",
|
||||
req_id
|
||||
);
|
||||
println!("Received TM[1,8] completion failure for request ID {req_id}");
|
||||
}
|
||||
} else {
|
||||
println!(
|
||||
|
@ -49,7 +49,7 @@ fn main() {
|
||||
let jh0 = thread::spawn(move || {
|
||||
let data = r0.recv().unwrap();
|
||||
let raw = data.get_data();
|
||||
println!("Received data {:?}", raw);
|
||||
println!("Received data {raw:?}");
|
||||
});
|
||||
let jh1 = thread::spawn(|| {});
|
||||
jh0.join().unwrap();
|
||||
|
@ -171,7 +171,7 @@ impl PusReceiver {
|
||||
let sender = self.request_map.get(&addressable_id.target_id).unwrap();
|
||||
sender
|
||||
.send(RequestWithToken(Request::HkRequest(request), token))
|
||||
.unwrap_or_else(|_| panic!("Sending HK request {:?} failed", request));
|
||||
.unwrap_or_else(|_| panic!("Sending HK request {request:?} failed"));
|
||||
};
|
||||
if PusPacket::subservice(pus_tc) == hk::Subservice::TcEnableGeneration as u8 {
|
||||
send_request(HkRequest::Enable(addressable_id));
|
||||
|
@ -51,10 +51,10 @@ impl Display for MpscStoreAndSendError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
MpscStoreAndSendError::StoreError(s) => {
|
||||
write!(f, "store error {}", s)
|
||||
write!(f, "store error {s}")
|
||||
}
|
||||
MpscStoreAndSendError::SendError(s) => {
|
||||
write!(f, "send error {}", s)
|
||||
write!(f, "send error {s}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -201,8 +201,8 @@ fn core_tmtc_loop(
|
||||
.ok();
|
||||
}
|
||||
Err(e) => {
|
||||
println!("error creating PUS TC from raw data: {}", e);
|
||||
println!("raw data: {:x?}", data);
|
||||
println!("error creating PUS TC from raw data: {e}");
|
||||
println!("raw data: {data:x?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -251,7 +251,7 @@ fn core_tm_handling(udp_tmtc_server: &mut UdpTmtcServer, recv_addr: &SocketAddr)
|
||||
if buf.len() > 9 {
|
||||
let service = buf[7];
|
||||
let subservice = buf[8];
|
||||
println!("Sending PUS TM[{},{}]", service, subservice)
|
||||
println!("Sending PUS TM[{service},{subservice}]")
|
||||
} else {
|
||||
println!("Sending PUS TM");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user