diff --git a/.github/workflows/autocorrect.yml b/.github/workflows/autocorrect.yml index f22be00..92292f2 100644 --- a/.github/workflows/autocorrect.yml +++ b/.github/workflows/autocorrect.yml @@ -11,4 +11,4 @@ jobs: fetch-depth: 1 - name: Lint - uses: huacnlee/autocorrect-action@v2.5.8 + uses: huacnlee/autocorrect-action@v2.9.0 diff --git a/src/README.md b/src/README.md index 5b8e3eb..1fc617d 100644 --- a/src/README.md +++ b/src/README.md @@ -88,9 +88,9 @@ - [Cargo 自定义扩展命令](ch14-05-extending-cargo.md) - [智能指针](ch15-00-smart-pointers.md) - - [使用`Box` 指向堆上数据](ch15-01-box.md) - - [使用`Deref` Trait 将智能指针当作常规引用处理](ch15-02-deref.md) - - [使用`Drop` Trait 运行清理代码](ch15-03-drop.md) + - [使用 `Box` 指向堆上数据](ch15-01-box.md) + - [使用 `Deref` Trait 将智能指针当作常规引用处理](ch15-02-deref.md) + - [使用 `Drop` Trait 运行清理代码](ch15-03-drop.md) - [`Rc` 引用计数智能指针](ch15-04-rc.md) - [`RefCell` 与内部可变性模式](ch15-05-interior-mutability.md) - [引用循环会导致内存泄漏](ch15-06-reference-cycles.md) @@ -99,7 +99,7 @@ - [使用线程同时地运行代码](ch16-01-threads.md) - [使用消息传递在线程间通信](ch16-02-message-passing.md) - [共享状态并发](ch16-03-shared-state.md) - - [使用`Sync` 与 `Send` Traits 的可扩展并发:](ch16-04-extensible-concurrency-sync-and-send.md) + - [使用 `Sync` 与 `Send` Traits 的可扩展并发:](ch16-04-extensible-concurrency-sync-and-send.md) - [Rust 的面向对象编程特性](ch17-00-oop.md) - [面向对象语言的特点](ch17-01-what-is-oo.md) diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 042a544..7e70ed3 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -88,9 +88,9 @@ - [Cargo 自定义扩展命令](ch14-05-extending-cargo.md) - [智能指针](ch15-00-smart-pointers.md) - - [使用`Box` 指向堆上数据](ch15-01-box.md) - - [使用`Deref` Trait 将智能指针当作常规引用处理](ch15-02-deref.md) - - [使用`Drop` Trait 运行清理代码](ch15-03-drop.md) + - [使用 `Box` 指向堆上数据](ch15-01-box.md) + - [使用 `Deref` Trait 将智能指针当作常规引用处理](ch15-02-deref.md) + - [使用 `Drop` Trait 运行清理代码](ch15-03-drop.md) - [`Rc` 引用计数智能指针](ch15-04-rc.md) - [`RefCell` 与内部可变性模式](ch15-05-interior-mutability.md) - [引用循环会导致内存泄漏](ch15-06-reference-cycles.md) @@ -99,7 +99,7 @@ - [使用线程同时地运行代码](ch16-01-threads.md) - [使用消息传递在线程间通信](ch16-02-message-passing.md) - [共享状态并发](ch16-03-shared-state.md) - - [使用`Sync` 与 `Send` Traits 的可扩展并发](ch16-04-extensible-concurrency-sync-and-send.md) + - [使用 `Sync` 与 `Send` Traits 的可扩展并发](ch16-04-extensible-concurrency-sync-and-send.md) - [Rust 的面向对象编程特性](ch17-00-oop.md) - [面向对象语言的特点](ch17-01-what-is-oo.md) diff --git a/src/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.md b/src/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.md index a46bc41..9e2131a 100644 --- a/src/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.md +++ b/src/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.md @@ -15,7 +15,7 @@ 回到示例 7-1,假设我们希望调用 `add_to_waitlist` 函数。还是同样的问题,`add_to_waitlist` 函数的路径是什么?在示例 7-3 中删除了一些模块和函数。 -我们在 crate 根定义了一个新函数 `eat_at_restaurant`,并在其中展示调用 `add_to_waitlist` 函数的两种方法。`eat_at_restaurant` 函数是我们 crate 库的一个公共 API,所以我们使用 `pub` 关键字来标记它。在 [“使用`pub`关键字暴露路径”][pub] 一节,我们将详细介绍 `pub`。注意,这个例子无法编译通过,我们稍后会解释原因。 +我们在 crate 根定义了一个新函数 `eat_at_restaurant`,并在其中展示调用 `add_to_waitlist` 函数的两种方法。`eat_at_restaurant` 函数是我们 crate 库的一个公共 API,所以我们使用 `pub` 关键字来标记它。在 [“使用 `pub` 关键字暴露路径”][pub] 一节,我们将详细介绍 `pub`。注意,这个例子无法编译通过,我们稍后会解释原因。 文件名:src/lib.rs diff --git a/src/ch17-01-what-is-oo.md b/src/ch17-01-what-is-oo.md index 44844b8..576b40a 100644 --- a/src/ch17-01-what-is-oo.md +++ b/src/ch17-01-what-is-oo.md @@ -40,7 +40,7 @@ {{#rustdoc_include ../listings/ch17-oop/listing-17-02/src/lib.rs:here}} ``` -示例 17-2: 在`AveragedCollection` 结构体上实现了`add`、`remove` 和 `average` 公有方法 +示例 17-2: 在 `AveragedCollection` 结构体上实现了 `add`、`remove` 和 `average` 公有方法 公有方法 `add`、`remove` 和 `average` 是修改 `AveragedCollection` 实例的唯一方式。当使用 `add` 方法把一个元素加入到 `list` 或者使用 `remove` 方法来删除时,这些方法的实现同时会调用私有的 `update_average` 方法来更新 `average` 字段。 diff --git a/src/ch17-03-oo-design-patterns.md b/src/ch17-03-oo-design-patterns.md index f076f65..a7e6e08 100644 --- a/src/ch17-03-oo-design-patterns.md +++ b/src/ch17-03-oo-design-patterns.md @@ -133,7 +133,7 @@ {{#rustdoc_include ../listings/ch17-oop/listing-17-17/src/lib.rs:here}} ``` -示例 17-17: 更新 `Post` 的 `content` 方法来委托调用 `State` 的`content` 方法 +示例 17-17: 更新 `Post` 的 `content` 方法来委托调用 `State` 的 `content` 方法 因为目标是将所有像这样的规则保持在实现了 `State` 的结构体中,我们将调用 `state` 中的值的 `content` 方法并传递博文实例(也就是 `self`)作为参数。接着返回 `state` 值的 `content` 方法的返回值。