Skip to content

Commit

Permalink
Cargo: Bump to 2021 edition
Browse files Browse the repository at this point in the history
Signed-off-by: Alistair Francis <[email protected]>
  • Loading branch information
alistair23 committed Jan 15, 2024
1 parent 6dcac95 commit bc9f27c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version = "0.1.0"
authors = ["Alistair Francis <[email protected]>"]
keywords = ["MCTP", "SMBus"]
categories = ["embedded", "encoding", "no-std", "parser-implementations", "parsing"]
edition = "2018"
edition = "2021"
readme = "README.md"

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#![no_std]
#![deny(missing_docs)]
#![allow(clippy::result_unit_err)]

#[macro_use]
extern crate bitfield;
Expand Down
6 changes: 3 additions & 3 deletions src/mctp_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ pub(crate) trait SMBusMCTPRequestResponse {
let header: MCTPMessageBodyHeader<[u8; 1]> =
MCTPMessageBodyHeader::new(false, MessageType::MCtpControl);

let body = MCTPMessageBody::new(&header, *message_header, &message_data, None);
let body = MCTPMessageBody::new(&header, *message_header, message_data, None);

let packet = MCTPSMBusPacket::new(&mut smbus_header, &base_header, &body);

Expand All @@ -167,7 +167,7 @@ pub(crate) trait SMBusMCTPRequestResponse {
let header: MCTPMessageBodyHeader<[u8; 1]> =
MCTPMessageBodyHeader::new(false, MessageType::VendorDefinedPCI);

let body = MCTPMessageBody::new(&header, *message_header, &message_data, None);
let body = MCTPMessageBody::new(&header, *message_header, message_data, None);

let packet = MCTPSMBusPacket::new(&mut smbus_header, &base_header, &body);

Expand All @@ -188,7 +188,7 @@ pub(crate) trait SMBusMCTPRequestResponse {
let header: MCTPMessageBodyHeader<[u8; 1]> =
MCTPMessageBodyHeader::new(false, MessageType::VendorDefinedIANA);

let body = MCTPMessageBody::new(&header, *message_header, &message_data, None);
let body = MCTPMessageBody::new(&header, *message_header, message_data, None);

let packet = MCTPSMBusPacket::new(&mut smbus_header, &base_header, &body);

Expand Down
10 changes: 5 additions & 5 deletions src/smbus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,11 @@ impl<'m> MCTPSMBusContext<'m> {
}

/// Decodes a MCTP request packet
fn decode_mctp_control<'a, 'b>(
fn decode_mctp_control<'a>(
&self,
smbus_header: &MCTPSMBusHeader<[u8; 4]>,
base_header: &MCTPTransportHeader<[u8; 4]>,
body_header: &'b MCTPMessageBodyHeader<[u8; 1]>,
body_header: &MCTPMessageBodyHeader<[u8; 1]>,
packet: &'a [u8],
calculated_pec: u8,
) -> Result<ControlDecodedPacketData<'a>, (MessageType, DecodeError)> {
Expand All @@ -425,10 +425,10 @@ impl<'m> MCTPSMBusContext<'m> {
/// an option. If `None` then `response_buf` wasn't changed because the
/// `packet` was not a request. If `Some` it contains the length of the
/// data written in the `response_buf`.
pub fn process_packet<'a, 'b>(
pub fn process_packet<'a>(
&self,
packet: &'a [u8],
response_buf: &'b mut [u8],
response_buf: &mut [u8],
) -> Result<(ControlDecodedPacketData<'a>, Option<usize>), (MessageType, DecodeError)> {
let (msg_type, payload) = self.decode_packet(packet)?;

Expand Down Expand Up @@ -529,7 +529,7 @@ impl<'m> MCTPSMBusContext<'m> {
.get_message_type_suport(
CompletionCode::Success,
base_header.source_endpoint_id(),
&self.msg_types,
self.msg_types,
response_buf,
)
.unwrap();
Expand Down
6 changes: 3 additions & 3 deletions src/smbus_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl MCTPSMBusContextRequest {
);
let message_header = Some(&(command_header.0[..]));

let message_data: [u8; 1] = [vendor_id as u8];
let message_data: [u8; 1] = [vendor_id];

self.generate_control_packet_bytes(dest_addr, &message_header, &message_data, buf)
}
Expand Down Expand Up @@ -508,13 +508,13 @@ impl MCTPSMBusContextRequest {
#[cfg(test)]
println!("message_header: {:#x?}", message_header);

self.generate_pci_msg_packet_bytes(dest_addr, &message_header, &msg, buf)
self.generate_pci_msg_packet_bytes(dest_addr, &message_header, msg, buf)
} else if format.format == 1 {
/* IANA message format */
let iana_msg_header = IANAMessageFormat::new(format.data);
let message_header = Some(&(iana_msg_header.0[..]));

self.generate_iana_msg_packet_bytes(dest_addr, &message_header, &msg, buf)
self.generate_iana_msg_packet_bytes(dest_addr, &message_header, msg, buf)
} else {
Err(())
}
Expand Down
4 changes: 2 additions & 2 deletions src/smbus_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl MCTPSMBusContextResponse {
// * Completion code
// * MCTP Message Type Count
// * List of Message Type numbers
let msg_type_count = supported_msg_types.len() as usize;
let msg_type_count = supported_msg_types.len();
let mut message_data: [u8; 32] = [0; 32];
message_data[0] = completion_code as u8;
message_data[1] = msg_type_count as u8;
Expand Down Expand Up @@ -273,7 +273,7 @@ impl MCTPSMBusContextResponse {
// * Vendor ID (variable length, between 3 and 5 bytes)
// * 16-bit numeric value or bit field, as specified by the vendor
// or organization identified by the vendor ID
let vendor_length = vendor_id.len() as usize;
let vendor_length = vendor_id.len();
let mut message_data: [u8; 9] = [
completion_code as u8,
vendor_id_selector,
Expand Down

0 comments on commit bc9f27c

Please sign in to comment.