maiyang

Results 222 issues of maiyang

函数返回结果 `Result` 不能用 `;`; 否则报错: ``` error[E0308]: mismatched types --> src/main.rs:94:27 | 94 | fn run(config: Config) -> Result { | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found () ``` 从提示应该很明显了,但是我看这个提示一直想了很久/尝试了很多次,都没有改正确,我还怀疑是中文文档的问题。...

question

## 0. Install Intellij or GoLand etc jetbrains IDE platform ## 1. Install Rust search Rust in Perferences/plugins. ![image](https://user-images.githubusercontent.com/1710912/56852237-3427d480-694b-11e9-87a5-7b599a90156e.png) ![image](https://user-images.githubusercontent.com/1710912/56852263-92ed4e00-694b-11e9-80f0-986fb55de9b6.png) tips: Preferences > Languages & Frameworks > Rust > Rustfmt...

tips

## 在 Rust 中必须以分号结束? ✅ ```Rust fn main() { let f = false; } ``` ❌ ```Rust fn main() { let f = false let f: bool = true; }...

tips

## editor.formatOnSave 保存 rust 文件即可实现 rustfmt; ## rust.build_on_save 保存 rust 文件即可 build; ## 参考资料 1. https://github.com/editor-rs/vscode-rust/issues/253 2. https://github.com/editor-rs/vscode-rust/blob/master/doc/format.md

tips

## 思考? ```Rust // 可以正确编译: cargo build let index = 10; let element = a[index]; println!("The value of element is: {}", element); // 编译报错:cargo build println!("a[0] is: {}, a[6] is:...

question

当我们在什么 `let remainder` 但是又没有使用它时,编译器会直接给出警告。 ``` warning: unused variable: `remainder` ``` 运动 `cargo run`,直接给出帮助提示: ``` | ^^^^^^^^^ help: consider prefixing with an underscore: `_remainder` ```

question

## 解决办法 1. 首先你得安装最新的 nightly 版本; >查看可用的最新的 nightly 版本:https://rust-lang.github.io/rustup-components-history/index.html 2. VSCode 安装 RLS 服务; 3. 命令行安装: ```sh $ rustup component add rust-src --toolchain nightly-2019-04-21-x86_64-apple-darwin $ rustup component add rust-analysis --toolchain...

question

VSCode 在打开 rs 文件后提示安装 rust-analysis 等,但是报错了 ```sh error: toolchain 'nightly-x86_64-apple-darwin' does not contain component 'rls' for target 'x86_64-apple-darwin' ``` 解决办法: https://github.com/rust-lang/rls#error-component-rls-is-unavailable-for-download-nightly 最终解决办法:https://github.com/rust-lang/rls/issues/641#issuecomment-354212877 ---- For those who made it here looking...

question

## 参考资料 1. [how-do-i-tell-vs-code-what-toolchain-i-want-to-use](https://stackoverflow.com/questions/45954354/how-do-i-tell-vs-code-what-toolchain-i-want-to-use)

question

https://github.com/talk-go/night/issues?q=is%3Aissue+is%3Aopen+label%3Aweekly-digest In last week, the weekly_digest not to run.