Skip to content

Commit c63da2a

Browse files
committed
fmt
Signed-off-by: sparkzky <[email protected]>
1 parent af27c52 commit c63da2a

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

kernel/src/net/socket/unix/ns/abs.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,7 @@ impl AbsHandleMap {
7474
///
7575
/// 分配到的可用的抽象端点
7676
pub fn alloc(&self, name: String) -> Option<Endpoint> {
77-
let abs_addr = match ABS_ADDRESS_ALLOCATOR.lock().alloc() {
78-
Some(addr) => addr,
79-
//地址被分配
80-
None => return None,
81-
};
77+
let abs_addr = ABS_ADDRESS_ALLOCATOR.lock().alloc()?;
8278

8379
let result = Some(Endpoint::Abspath((AbsHandle::new(abs_addr), name)));
8480

kernel/src/net/socket/unix/seqpacket/inner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl Listener {
126126
}
127127

128128
pub(super) fn is_acceptable(&self) -> bool {
129-
return self.incoming_conns.lock().len() != 0;
129+
!self.incoming_conns.lock().is_empty()
130130
}
131131
}
132132

kernel/src/net/socket/unix/stream/inner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl Listener {
228228
}
229229

230230
pub(super) fn is_acceptable(&self) -> bool {
231-
return self.incoming_connects.lock().len() != 0;
231+
!self.incoming_connects.lock().is_empty()
232232
}
233233

234234
pub(super) fn try_accept(&self) -> Result<(Arc<SocketInode>, Endpoint), SystemError> {

0 commit comments

Comments
 (0)