Browse Source

fmt

Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
sparkzky 5 days ago
parent
commit
c63da2a419

+ 1 - 5
kernel/src/net/socket/unix/ns/abs.rs

@@ -74,11 +74,7 @@ impl AbsHandleMap {
     ///
     /// 分配到的可用的抽象端点
     pub fn alloc(&self, name: String) -> Option<Endpoint> {
-        let abs_addr = match ABS_ADDRESS_ALLOCATOR.lock().alloc() {
-            Some(addr) => addr,
-            //地址被分配
-            None => return None,
-        };
+        let abs_addr = ABS_ADDRESS_ALLOCATOR.lock().alloc()?;
 
         let result = Some(Endpoint::Abspath((AbsHandle::new(abs_addr), name)));
 

+ 1 - 1
kernel/src/net/socket/unix/seqpacket/inner.rs

@@ -126,7 +126,7 @@ impl Listener {
     }
 
     pub(super) fn is_acceptable(&self) -> bool {
-        return self.incoming_conns.lock().len() != 0;
+        !self.incoming_conns.lock().is_empty()
     }
 }
 

+ 1 - 1
kernel/src/net/socket/unix/stream/inner.rs

@@ -228,7 +228,7 @@ impl Listener {
     }
 
     pub(super) fn is_acceptable(&self) -> bool {
-        return self.incoming_connects.lock().len() != 0;
+        !self.incoming_connects.lock().is_empty()
     }
 
     pub(super) fn try_accept(&self) -> Result<(Arc<SocketInode>, Endpoint), SystemError> {