Skip to content

Commit 5bdb42a

Browse files
committed
[rustfmt] drop use_small_heuristics
1 parent 54e0907 commit 5bdb42a

13 files changed

+577
-152
lines changed

rustfmt.toml

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ use_try_shorthand = true
1010
# Use field initialize shorthand if possible.
1111
use_field_init_shorthand = true
1212

13-
# Use max width for all single-line constructs
14-
use_small_heuristics = "Max"
15-
1613
### UNSTABLE FEATURES
1714

1815
# Convert /* */ comments to // comments where possible

src/cidr/direct.rs

+20-5
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ macro_rules! impl_cidr_for {
6565
}
6666

6767
fn null() -> Self {
68-
Self { address: FixedBitString::new_all_false(), network_length: 0 }
68+
Self {
69+
address: FixedBitString::new_all_false(),
70+
network_length: 0,
71+
}
6972
}
7073

7174
fn shared_prefix_len(&self, other: &Self) -> usize {
@@ -85,14 +88,20 @@ macro_rules! impl_cidr_for {
8588
} else if !addr._has_zero_host_part(len) {
8689
Err(NetworkParseError::InvalidHostPart)
8790
} else {
88-
Ok(Self { address: addr, network_length: len })
91+
Ok(Self {
92+
address: addr,
93+
network_length: len,
94+
})
8995
}
9096
}
9197

9298
/// Create a network containing a single address (network length =
9399
/// address length).
94100
pub fn new_host(addr: $addr) -> Self {
95-
Self { address: addr, network_length: $family.len() }
101+
Self {
102+
address: addr,
103+
network_length: $family.len(),
104+
}
96105
}
97106

98107
/// Iterate over all addresses in the range. With IPv6 addresses
@@ -109,7 +118,10 @@ macro_rules! impl_cidr_for {
109118

110119
/// first address in the network
111120
pub fn first(&self) -> $inet {
112-
$inet { address: self.first_address(), network_length: self.network_length }
121+
$inet {
122+
address: self.first_address(),
123+
network_length: self.network_length,
124+
}
113125
}
114126

115127
/// last address in the network as plain address
@@ -119,7 +131,10 @@ macro_rules! impl_cidr_for {
119131

120132
/// last address in the network
121133
pub fn last(&self) -> $inet {
122-
$inet { address: self.last_address(), network_length: self.network_length }
134+
$inet {
135+
address: self.last_address(),
136+
network_length: self.network_length,
137+
}
123138
}
124139

125140
/// length in bits of the shared prefix of the contained addresses

src/cidr/from_str.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ where
1313
{
1414
match s.rfind('/') {
1515
None => Ok(C::new_host(C::Address::address_from_str(s)?)),
16-
Some(pos) => {
17-
C::new(C::Address::address_from_str(&s[0..pos])?, u8::from_str(&s[pos + 1..])?)
18-
},
16+
Some(pos) => C::new(
17+
C::Address::address_from_str(&s[0..pos])?,
18+
u8::from_str(&s[pos + 1..])?,
19+
),
1920
}
2021
}

src/cidr/serde/tests.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ where
2222
panic!("failed serializing {:?}: {}", value, e);
2323
});
2424

25-
assert_eq!(&s as &[u8], raw, "unexpected result serializing {:?}", value);
25+
assert_eq!(
26+
&s as &[u8], raw,
27+
"unexpected result serializing {:?}",
28+
value
29+
);
2630

2731
assert_eq!(
2832
&bincode::deserialize::<T>(raw).unwrap(),

0 commit comments

Comments
 (0)