cargo fmt rust code (#1131)

* cargo fmt code

* Add empty line to seperate unrelated comments

* Fix review

* Update bubble_sort.rs

* Update merge_sort.rs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
rongyi
2024-03-16 02:13:41 +08:00
committed by GitHub
parent 54ceef3443
commit 7b1094318b
70 changed files with 1021 additions and 836 deletions
@@ -6,10 +6,10 @@
include!("../include/include.rs");
use list_node::ListNode;
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use std::cell::RefCell;
use list_node::ListNode;
/* 哈希查找(数组) */
fn hashing_search_array<'a>(map: &'a HashMap<i32, usize>, target: i32) -> Option<&'a usize> {
@@ -19,7 +19,10 @@ fn hashing_search_array<'a>(map: &'a HashMap<i32, usize>, target: i32) -> Option
}
/* 哈希查找(链表) */
fn hashing_search_linked_list(map: &HashMap<i32, Rc<RefCell<ListNode<i32>>>>, target: i32) -> Option<&Rc<RefCell<ListNode<i32>>>> {
fn hashing_search_linked_list(
map: &HashMap<i32, Rc<RefCell<ListNode<i32>>>>,
target: i32,
) -> Option<&Rc<RefCell<ListNode<i32>>>> {
// 哈希表的 key: 目标节点值,value: 节点对象
// 若哈希表中无此 key ,返回 None
map.get(&target)
@@ -30,7 +33,7 @@ pub fn main() {
let target = 3;
/* 哈希查找(数组) */
let nums = [ 1, 5, 3, 2, 4, 7, 5, 9, 10, 8 ];
let nums = [1, 5, 3, 2, 4, 7, 5, 9, 10, 8];
// 初始化哈希表
let mut map = HashMap::new();
for (i, num) in nums.iter().enumerate() {