From 50c1bba4b3a130c48dc10602e098bda4be906daa Mon Sep 17 00:00:00 2001 From: CarrotDLaw Date: Sun, 12 May 2024 16:25:39 +0800 Subject: [PATCH] docs: update comments --- codes/rust/chapter_array_and_linkedlist/array.rs | 2 +- docs/chapter_array_and_linkedlist/array.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/codes/rust/chapter_array_and_linkedlist/array.rs b/codes/rust/chapter_array_and_linkedlist/array.rs index 68fc18e2e..c529105a3 100644 --- a/codes/rust/chapter_array_and_linkedlist/array.rs +++ b/codes/rust/chapter_array_and_linkedlist/array.rs @@ -77,7 +77,7 @@ fn main() { let slice: &[i32] = &[0; 5]; print!("数组 arr = "); print_util::print_array(&arr); - // 在 Rust 中,指定长度时([i32; 5])为数组 + // 在 Rust 中,指定长度时([i32; 5])为数组,不指定长度时(&[i32])为切片 // 由于 Rust 的数组被设计为在编译期确定长度,因此只能使用常量来指定长度 // Vector 是 Rust 一般情况下用作动态数组的类型 // 为了方便实现扩容 extend() 方法,以下将 vector 看作数组(array) diff --git a/docs/chapter_array_and_linkedlist/array.md b/docs/chapter_array_and_linkedlist/array.md index cb9b53111..98452f0b7 100755 --- a/docs/chapter_array_and_linkedlist/array.md +++ b/docs/chapter_array_and_linkedlist/array.md @@ -95,7 +95,7 @@ /* 初始化数组 */ let arr: [i32; 5] = [0; 5]; // [0, 0, 0, 0, 0] let slice: &[i32] = &[0; 5]; - // 在 Rust 中,指定长度时([i32; 5])为数组 + // 在 Rust 中,指定长度时([i32; 5])为数组,不指定长度时(&[i32])为切片 // 由于 Rust 的数组被设计为在编译期确定长度,因此只能使用常量来指定长度 // Vector 是 Rust 一般情况下用作动态数组的类型 // 为了方便实现扩容 extend() 方法,以下将 vector 看作数组(array)