Merge pull request #1989 from fwqaaq/master

Update 24. 两两交换链表中的节点 about rust 优化
This commit is contained in:
程序员Carl
2023-06-29 10:00:56 +08:00
committed by GitHub

View File

@ -409,7 +409,7 @@ impl Solution {
// 递归
impl Solution {
pub fn swap_pairs(head: Option<Box<ListNode>>) -> Option<Box<ListNode>> {
if head == None || head.as_ref().unwrap().next == None {
if head.is_none() || head.as_ref().unwrap().next.is_none() {
return head;
}