Skip to content

Commit b2541d5

Browse files
committed
Run cargo clippy
Signed-off-by: Gris Ge <[email protected]>
1 parent 2eda618 commit b2541d5

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

src/rtnl/link/message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ mod test {
235235

236236
let packet = LinkMessage { header, nlas };
237237

238-
let mut buf = vec![0; 96];
238+
let mut buf = [0; 96];
239239

240240
assert_eq!(packet.buffer_len(), 96);
241241
packet.emit(&mut buf[..]);

src/rtnl/link/nlas/link_infos.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,8 +1810,7 @@ mod tests {
18101810
#[rustfmt::skip]
18111811
#[test]
18121812
fn parse_veth_info() {
1813-
let data = vec![
1814-
0x08, 0x00, // length = 8
1813+
let data = [0x08, 0x00, // length = 8
18151814
0x01, 0x00, // type = 1 = IFLA_INFO_KIND
18161815
0x76, 0x65, 0x74, 0x68, // VETH
18171816

@@ -1834,8 +1833,7 @@ mod tests {
18341833
// NLA
18351834
0x08, 0x00, // length = 8
18361835
0x0d, 0x00, // type = IFLA_TXQLEN
1837-
0x00, 0x00, 0x00, 0x00,
1838-
];
1836+
0x00, 0x00, 0x00, 0x00];
18391837
let nla = NlaBuffer::new_checked(&data[..]).unwrap();
18401838
let parsed = VecInfo::parse(&nla).unwrap().0;
18411839
let expected = vec![
@@ -1860,8 +1858,7 @@ mod tests {
18601858
#[rustfmt::skip]
18611859
#[test]
18621860
fn parse_info_bondport() {
1863-
let data = vec![
1864-
0x09, 0x00, // length
1861+
let data = [0x09, 0x00, // length
18651862
0x04, 0x00, // IFLA_INFO_PORT_KIND
18661863
0x62, 0x6f, 0x6e, 0x64, 0x00, // V = "bond\0"
18671864
0x00, 0x00, 0x00, // padding
@@ -1875,9 +1872,7 @@ mod tests {
18751872

18761873
0x08, 0x00, // length
18771874
0x09, 0x00, // IFLA_BOND_PORT_PRIO
1878-
0x32, 0x00, 0x00, 0x00, // 50
1879-
1880-
];
1875+
0x32, 0x00, 0x00, 0x00];
18811876
let nla = NlaBuffer::new_checked(&data[..]).unwrap();
18821877
let parsed = VecInfo::parse(&nla).unwrap().0;
18831878
let expected = vec![
@@ -1892,8 +1887,7 @@ mod tests {
18921887
#[rustfmt::skip]
18931888
#[test]
18941889
fn parse_info_bond() {
1895-
let data = vec![
1896-
0x08, 0x00, // length
1890+
let data = [0x08, 0x00, // length
18971891
0x01, 0x00, // IFLA_INFO_KIND
18981892
0x62, 0x6f, 0x6e, 0x64, // "bond"
18991893

@@ -1956,8 +1950,7 @@ mod tests {
19561950
0x05, 0x00, // IFLA_BOND_AD_INFO_PARTNER_MAC
19571951
0x00, 0x11, 0x22, // 00:11:22:33:44:55
19581952
0x33, 0x44, 0x55,
1959-
0x00, 0x00, // padding
1960-
];
1953+
0x00, 0x00];
19611954
let nla = NlaBuffer::new_checked(&data[..]).unwrap();
19621955
let parsed = VecInfo::parse(&nla).unwrap().0;
19631956
let expected = vec![

src/rtnl/link/nlas/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ fn parse_af_inet() {
358358

359359
#[test]
360360
fn emit_af_inet() {
361-
let mut bytes = vec![0xff; 132];
361+
let mut bytes = [0xff; 132];
362362

363363
// Note: the value is a Vec of nlas, so the padding is automatically added
364364
// for each nla.

src/rtnl/neighbour/message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ mod test {
115115

116116
let nlas = vec![];
117117
let packet = NeighbourMessage { header, nlas };
118-
let mut buf = vec![0; 12];
118+
let mut buf = [0; 12];
119119

120120
assert_eq!(packet.buffer_len(), 12);
121121
packet.emit(&mut buf[..]);

0 commit comments

Comments
 (0)