Skip to content

Commit 61796c9

Browse files
committed
付録D: 便利な開発ツールの和訳をアップデート
rust-lang/book@19c40bf
1 parent 8a44126 commit 61796c9

File tree

1 file changed

+37
-43
lines changed

1 file changed

+37
-43
lines changed

src/appendix-04-useful-development-tools.md

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ warning fixes, a linter, and integrating with IDEs.
1818

1919

2020
<!--
21-
The `rustfmt` tool reformats your code according to the community code style.
21+
The `rustfmt` tool reformats your code according to the community code style.
2222
Many collaborative projects use `rustfmt` to prevent arguments about which
2323
style to use when writing Rust: everyone formats their code using the tool.
2424
-->
@@ -63,11 +63,13 @@ on `rustfmt`, see [its documentation][rustfmt].
6363

6464
<!--
6565
The rustfix tool is included with Rust installations and can automatically fix
66-
some compiler warnings. If you’ve written code in Rust, you’ve probably seen
67-
compiler warnings. For example, consider this code:
66+
compiler warnings that have a clear way to correct the problem that’s likely
67+
what you want. It’s likely you’ve seen compiler warnings before. For example,
68+
consider this code:
6869
-->
69-
rustfixというツールはRustをインストールすると同梱されており、コンパイラの警告 (warning) を自動で直してくれます。
70-
Rustでコードを書いたことがある人なら、コンパイラの警告を見たことがあるでしょう。
70+
Rustをインストールすると、rustfixというツールが同梱されています。
71+
rustfixは、問題を修正するために誰でもそうするであろう自明な修正方法があるコンパイラの警告 (warning) を、自動で直してくれます。
72+
おそらくコンパイラの警告を以前に見たことがあるでしょう。
7173
たとえば、下のコードを考えます:
7274

7375
<span class="filename">Filename: src/main.rs</span>
@@ -95,7 +97,7 @@ $ cargo build
9597
warning: unused variable: `i`
9698
--> src/main.rs:4:9
9799
|
98-
4 | for i in 1..100 {
100+
4 | for i in 0..100 {
99101
| ^ help: consider using `_i` instead
100102
|
101103
= note: #[warn(unused_variables)] on by default
@@ -203,21 +205,22 @@ Running `cargo clippy` on this project results in this error:
203205
`cargo clippy`をこのプロジェクトに実行すると次のエラーを得ます:
204206

205207
```text
206-
error: approximate value of `f{32, 64}::consts::PI` found. Consider using it directly
208+
error: approximate value of `f{32, 64}::consts::PI` found
207209
--> src/main.rs:2:13
208210
|
209211
2 | let x = 3.1415;
210212
| ^^^^^^
211213
|
212-
= note: #[deny(clippy::approx_constant)] on by default
213-
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/master/index.html#approx_constant
214+
= note: `#[deny(clippy::approx_constant)]` on by default
215+
= help: consider using the constant directly
216+
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant
214217
```
215218

216219
<!--
217-
This error lets you know that Rust has this constant defined more precisely and
218-
that your program would be more correct if you used the constant instead. You
219-
would then change your code to use the `PI` constant. The following code
220-
doesn’t result in any errors or warnings from Clippy:
220+
This error lets you know that Rust has this constant defined more precisely
221+
and that your program would be more correct if you used the constant
222+
instead. You would then change your code to use the `PI` constant. The
223+
following code doesn’t result in any errors or warnings from Clippy:
221224
-->
222225
あなたは、このエラーのおかげで、Rustにはより正確に定義された定数がすでにあり、これを代わりに使うとプログラムがより正しくなるかもしれないと気づくことができます。
223226
なので、あなたはコードを定数`PI`を使うように変更するでしょう。
@@ -244,43 +247,34 @@ Clippyについてより詳しく知るには、[ドキュメント][clippy]を
244247
[clippy]: https://github.com/rust-lang/rust-clippy
245248

246249
<!--
247-
### IDE Integration Using the Rust Language Server
250+
### IDE Integration Using `rust-analyzer`
248251
-->
249-
### Rust Language Serverを使ってIDEと統合する
252+
### `rust-analyzer`を使ってIDEと統合する
250253

251254
<!--
252-
To help IDE integration, the Rust project distributes the *Rust Language
253-
Server* (`rls`). This tool speaks the [Language Server
254-
Protocol][lsp], which is a specification for IDEs and programming
255-
languages to communicate with each other. Different clients can use the `rls`,
256-
such as [the Rust plug-in for Visual Studio Code][vscode].
255+
To help IDE integration, the Rust community recommends using
256+
[`rust-analyzer`][rust-analyzer]. This tool is a set of
257+
compiler-centric utilities that speaks the [Language Server Protocol][lsp]
258+
, which is a specification for IDEs and programming languages to
259+
communicate with each other. Different clients can use `rust-analyzer`, such as
260+
[the Rust analyzer plug-in for Visual Studio Code][vscode].
257261
-->
258-
IDEでの開発の助けになるよう、Rustプロジェクトは *Rust Language Server* (`rls`)を配布しています。
259-
このツールは、[Language Server Protocol][lsp]という、IDEとプログラミング言語が対話するための仕様に対応しています。
260-
[Visual Studio CodeのRustプラグイン][vscode]をはじめ、様々なクライアントが`rls`を使うことができます。
262+
IDEでの開発の助けになるよう、Rustコミュニティは[`rust-analyzer`][rust-analyzer]の使用を推奨しています。
263+
このツールは、IDEとプログラミング言語が対話するための仕様である[Language Server Protocol][lsp]に対応した、
264+
コンパイラを中心としたユーティリティ群です。
265+
[Visual Studio CodeのRustプラグイン][vscode]をはじめ、様々なクライアントが`rust-analyzer`を使うことができます。
261266

262267
[lsp]: http://langserver.org/
263-
[vscode]: https://marketplace.visualstudio.com/items?itemName=rust-lang.rust
268+
[vscode]: https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer
264269

265270
<!--
266-
To install the `rls`, enter the following:
271+
Visit the `rust-analyzer` project’s [home page][rust-analyzer]
272+
for installation instructions, then install the language server support in your
273+
particular IDE. Your IDE will gain abilities such as autocompletion, jump to
274+
definition, and inline errors.
267275
-->
268-
`rls`をインストールするには、以下を入力してください:
276+
`rust-analyzer`プロジェクトの[ホームページ][rust-analyzer]でインストール手順を確認し、
277+
使用中のIDE向けの言語サーバサポートをインストールしてください。
278+
使用中のIDEに、自動補完、定義へのジャンプ、インラインのエラー表示などの機能が得られるはずです。
269279

270-
```console
271-
$ rustup component add rls
272-
```
273-
274-
<!--
275-
Then install the language server support in your particular IDE; you’ll gain
276-
abilities such as autocompletion, jump to definition, and inline errors.
277-
-->
278-
つづけて、あなたのIDE向けのlanguage serverサポートをインストールしてください。
279-
すると、自動補完、定義へのジャンプ、インラインのエラー表示などの機能が得られるはずです。
280-
281-
<!--
282-
For more information on the `rls`, see [its documentation][rls].
283-
-->
284-
`rls`についてより詳しく知るには[ドキュメント][rls]を読んでください。
285-
286-
[rls]: https://github.com/rust-lang/rls
280+
[rust-analyzer]: https://rust-analyzer.github.io

0 commit comments

Comments
 (0)