Allow DeviceCapabilities to be initialized
This was flagged by `cargo clippy`: warning: field assignment outside of initializer for an instance created with Default::default() This changes the visibility of the dummy field to be public, but only to the crate.
This commit is contained in:
parent
ea4579d68a
commit
cb66f9f036
|
@ -217,7 +217,7 @@ pub struct DeviceCapabilities {
|
|||
|
||||
/// Only present to prevent people from trying to initialize every field of DeviceLimits,
|
||||
/// which would not let us add new fields in the future.
|
||||
dummy: ()
|
||||
pub(crate) dummy: ()
|
||||
}
|
||||
|
||||
/// An interface for sending and receiving raw network frames.
|
||||
|
|
|
@ -1972,8 +1972,10 @@ mod test {
|
|||
|
||||
fn recv<F>(socket: &mut TcpSocket, timestamp: Instant, mut f: F)
|
||||
where F: FnMut(Result<TcpRepr>) {
|
||||
let mut caps = DeviceCapabilities::default();
|
||||
caps.max_transmission_unit = 1520;
|
||||
let caps = DeviceCapabilities {
|
||||
max_transmission_unit: 1520,
|
||||
..Default::default()
|
||||
};
|
||||
let result = socket.dispatch(timestamp, &caps, |(ip_repr, tcp_repr)| {
|
||||
let ip_repr = ip_repr.lower(&[IpCidr::new(LOCAL_END.addr, 24)]).unwrap();
|
||||
|
||||
|
@ -4821,8 +4823,10 @@ mod test {
|
|||
#[test]
|
||||
fn test_set_hop_limit() {
|
||||
let mut s = socket_syn_received();
|
||||
let mut caps = DeviceCapabilities::default();
|
||||
caps.max_transmission_unit = 1520;
|
||||
let caps = DeviceCapabilities {
|
||||
max_transmission_unit: 1520,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
s.set_hop_limit(Some(0x2a));
|
||||
assert_eq!(s.dispatch(Instant::from_millis(0), &caps, |(ip_repr, _)| {
|
||||
|
|
Loading…
Reference in New Issue