[Rust] make rust part more idomatic and fix panic of backtrack template (#1370)

* Drop unused variable

* Idiomatic rust

* Fix panic template
This commit is contained in:
rongyi
2024-05-24 16:21:17 +08:00
committed by GitHub
parent aa818945f0
commit 63bcdb798a
5 changed files with 27 additions and 28 deletions

View File

@ -74,7 +74,6 @@ fn find(nums: &[i32], target: i32) -> Option<usize> {
fn main() {
/* 初始化数组 */
let arr: [i32; 5] = [0; 5];
let slice: &[i32] = &[0; 5];
print!("数组 arr = ");
print_util::print_array(&arr);
// 在 Rust 中,指定长度时([i32; 5])为数组,不指定长度时(&[i32])为切片