@@ -18,7 +18,7 @@ warning fixes, a linter, and integrating with IDEs.
18
18
19
19
20
20
<!--
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.
22
22
Many collaborative projects use `rustfmt` to prevent arguments about which
23
23
style to use when writing Rust: everyone formats their code using the tool.
24
24
-->
@@ -63,11 +63,13 @@ on `rustfmt`, see [its documentation][rustfmt].
63
63
64
64
<!--
65
65
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:
68
69
-->
69
- rustfixというツールはRustをインストールすると同梱されており、コンパイラの警告 (warning) を自動で直してくれます。
70
- Rustでコードを書いたことがある人なら、コンパイラの警告を見たことがあるでしょう。
70
+ Rustをインストールすると、rustfixというツールが同梱されています。
71
+ rustfixは、問題を修正するために誰でもそうするであろう自明な修正方法があるコンパイラの警告 (warning) を、自動で直してくれます。
72
+ おそらくコンパイラの警告を以前に見たことがあるでしょう。
71
73
たとえば、下のコードを考えます:
72
74
73
75
<span class =" filename " >Filename: src/main.rs</span >
@@ -95,7 +97,7 @@ $ cargo build
95
97
warning: unused variable: `i`
96
98
--> src/main.rs:4:9
97
99
|
98
- 4 | for i in 1 ..100 {
100
+ 4 | for i in 0 ..100 {
99
101
| ^ help: consider using `_i` instead
100
102
|
101
103
= note: #[warn(unused_variables)] on by default
@@ -203,21 +205,22 @@ Running `cargo clippy` on this project results in this error:
203
205
` cargo clippy ` をこのプロジェクトに実行すると次のエラーを得ます:
204
206
205
207
``` 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
207
209
--> src/main.rs:2:13
208
210
|
209
211
2 | let x = 3.1415;
210
212
| ^^^^^^
211
213
|
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
214
217
```
215
218
216
219
<!--
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:
221
224
-->
222
225
あなたは、このエラーのおかげで、Rustにはより正確に定義された定数がすでにあり、これを代わりに使うとプログラムがより正しくなるかもしれないと気づくことができます。
223
226
なので、あなたはコードを定数` PI ` を使うように変更するでしょう。
@@ -244,43 +247,34 @@ Clippyについてより詳しく知るには、[ドキュメント][clippy]を
244
247
[ clippy ] : https://github.com/rust-lang/rust-clippy
245
248
246
249
<!--
247
- ### IDE Integration Using the Rust Language Server
250
+ ### IDE Integration Using `rust-analyzer`
248
251
-->
249
- ### Rust Language Serverを使ってIDEと統合する
252
+ ### ` rust-analyzer ` を使ってIDEと統合する
250
253
251
254
<!--
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].
257
261
-->
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 ` を使うことができます。
261
266
262
267
[ 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
264
269
265
270
<!--
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.
267
275
-->
268
- ` rls ` をインストールするには、以下を入力してください:
276
+ ` rust-analyzer ` プロジェクトの[ ホームページ] [ rust-analyzer ] でインストール手順を確認し、
277
+ 使用中のIDE向けの言語サーバサポートをインストールしてください。
278
+ 使用中のIDEに、自動補完、定義へのジャンプ、インラインのエラー表示などの機能が得られるはずです。
269
279
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