File tree 1 file changed +5
-12
lines changed
1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -192,12 +192,8 @@ pub async fn nic() -> Result<impl Stream<Item = Result<Nic>> + Send + Sync> {
192
192
// Step 3 - walk through the list and populate our interfaces
193
193
let mut p_next_iface = buffer. as_ptr ( ) as PIP_ADAPTER_ADDRESSES ;
194
194
195
- let mut cur_iface;
196
- loop {
197
- if p_next_iface. is_null ( ) {
198
- break ;
199
- }
200
- cur_iface = unsafe { * p_next_iface } ;
195
+ while !p_next_iface. is_null ( ) {
196
+ let cur_iface = unsafe { * p_next_iface } ;
201
197
202
198
let iface_index = unsafe { cur_iface. u . s ( ) . IfIndex } ;
203
199
let iface_guid_cstr;
@@ -229,12 +225,9 @@ pub async fn nic() -> Result<impl Stream<Item = Result<Nic>> + Send + Sync> {
229
225
230
226
// Walk through every IP address of this interface
231
227
let mut p_next_address = cur_iface. FirstUnicastAddress ;
232
- let mut cur_address;
233
- loop {
234
- if p_next_address. is_null ( ) {
235
- break ;
236
- }
237
- cur_address = unsafe { * p_next_address } ;
228
+
229
+ while !p_next_address. is_null ( ) {
230
+ let cur_address = unsafe { * p_next_address } ;
238
231
239
232
let this_socket_address = cur_address. Address ;
240
233
let this_netmask_length = cur_address. OnLinkPrefixLength ;
You can’t perform that action at this time.
0 commit comments