@@ -7,7 +7,9 @@ use netlink_packet_utils::{
7
7
DecodeError , Emitable , Parseable , ParseableParametrized ,
8
8
} ;
9
9
10
- use crate :: { address:: MptcpPathManagerAddressAttr , limits:: MptcpPathManagerLimitsAttr } ;
10
+ use crate :: {
11
+ address:: MptcpPathManagerAddressAttr , limits:: MptcpPathManagerLimitsAttr ,
12
+ } ;
11
13
12
14
const MPTCP_PM_CMD_GET_ADDR : u8 = 3 ;
13
15
const MPTCP_PM_CMD_GET_LIMITS : u8 = 6 ;
@@ -113,12 +115,15 @@ impl Emitable for MptcpPathManagerMessage {
113
115
fn parse_nlas ( buffer : & [ u8 ] ) -> Result < Vec < MptcpPathManagerAttr > , DecodeError > {
114
116
let mut nlas = Vec :: new ( ) ;
115
117
for nla in NlasIterator :: new ( buffer) {
116
- let error_msg = format ! ( "Failed to parse mptcp address message attribute {:?}" , nla) ;
118
+ let error_msg =
119
+ format ! ( "Failed to parse mptcp address message attribute {nla:?}" ) ;
117
120
let nla = & nla. context ( error_msg) ?;
118
121
match nla. kind ( ) {
119
122
MPTCP_PM_ATTR_ADDR => {
120
123
for addr_nla in NlasIterator :: new ( nla. value ( ) ) {
121
- let error_msg = format ! ( "Failed to parse MPTCP_PM_ATTR_ADDR {:?}" , addr_nla) ;
124
+ let error_msg = format ! (
125
+ "Failed to parse MPTCP_PM_ATTR_ADDR {addr_nla:?}"
126
+ ) ;
122
127
let addr_nla = & addr_nla. context ( error_msg) ?;
123
128
124
129
nlas. push ( MptcpPathManagerAttr :: Address (
@@ -127,10 +132,13 @@ fn parse_nlas(buffer: &[u8]) -> Result<Vec<MptcpPathManagerAttr>, DecodeError> {
127
132
) )
128
133
}
129
134
}
130
- MPTCP_PM_ATTR_RCV_ADD_ADDRS => nlas. push ( MptcpPathManagerAttr :: Limits (
131
- MptcpPathManagerLimitsAttr :: parse ( nla)
132
- . context ( "Failed to parse MPTCP_PM_ATTR_RCV_ADD_ADDRS" ) ?,
133
- ) ) ,
135
+ MPTCP_PM_ATTR_RCV_ADD_ADDRS => {
136
+ nlas. push ( MptcpPathManagerAttr :: Limits (
137
+ MptcpPathManagerLimitsAttr :: parse ( nla) . context (
138
+ "Failed to parse MPTCP_PM_ATTR_RCV_ADD_ADDRS" ,
139
+ ) ?,
140
+ ) )
141
+ }
134
142
MPTCP_PM_ATTR_SUBFLOWS => nlas. push ( MptcpPathManagerAttr :: Limits (
135
143
MptcpPathManagerLimitsAttr :: parse ( nla)
136
144
. context ( "Failed to parse MPTCP_PM_ATTR_RCV_ADD_ADDRS" ) ?,
@@ -144,7 +152,10 @@ fn parse_nlas(buffer: &[u8]) -> Result<Vec<MptcpPathManagerAttr>, DecodeError> {
144
152
}
145
153
146
154
impl ParseableParametrized < [ u8 ] , GenlHeader > for MptcpPathManagerMessage {
147
- fn parse_with_param ( buffer : & [ u8 ] , header : GenlHeader ) -> Result < Self , DecodeError > {
155
+ fn parse_with_param (
156
+ buffer : & [ u8 ] ,
157
+ header : GenlHeader ,
158
+ ) -> Result < Self , DecodeError > {
148
159
Ok ( match header. cmd {
149
160
MPTCP_PM_CMD_GET_ADDR => Self {
150
161
cmd : MptcpPathManagerCmd :: AddressGet ,
@@ -156,8 +167,7 @@ impl ParseableParametrized<[u8], GenlHeader> for MptcpPathManagerMessage {
156
167
} ,
157
168
cmd => {
158
169
return Err ( DecodeError :: from ( format ! (
159
- "Unsupported mptcp reply command: {}" ,
160
- cmd
170
+ "Unsupported mptcp reply command: {cmd}"
161
171
) ) )
162
172
}
163
173
} )
0 commit comments