rustlings icon indicating copy to clipboard operation
rustlings copied to clipboard

Clippy exercises panic in codespaces

Open bglebrun opened this issue 2 years ago • 1 comments

Hi, I really love rustlings, thank you for this really great tool!

The clippy exercises seem to panic during a watch or run clippy1 inside of codespaces. This does not happen when I run the exercises on a local machine.

⠁ Compiling exercises/22_clippy/clippy1.rs...                                                                                                                                                                                                                                     thread 'main' panicked at src/exercise.rs:138:63:
Failed to write 📎 Clippy 📎 Cargo.toml file.: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I tried to run an install command in order to check that clippy was installed

@bglebrun ➜ /workspaces/rustlings (main) $ rustup component add clippy
info: component 'clippy' for target 'x86_64-unknown-linux-gnu' is up to date

version output

@bglebrun ➜ /workspaces/rustlings (main) $ rustc --version
rustc 1.73.0 (cc66ad468 2023-10-03)
@bglebrun ➜ /workspaces/rustlings (main) $ rustlings --version
rustlings 5.6.1
@bglebrun ➜ /workspaces/rustlings (main) $ ls -la
total 7576
drwxrwxrwx+ 11 codespace root         4096 Nov 16 03:35 .
drwxr-xrwx+  4 codespace root         4096 Nov  9 04:13 ..
-rw-rw-rw-   1 codespace root        68289 Nov  9 04:13 .all-contributorsrc
drwxrwxrwx+  2 codespace root         4096 Nov  9 04:13 .devcontainer
-rw-rw-rw-   1 codespace root          102 Nov  9 04:13 .editorconfig
drwxrwxrwx+  9 codespace root         4096 Nov 16 03:23 .git
drwxrwxrwx+  3 codespace root         4096 Nov  9 04:13 .github
-rw-rw-rw-   1 codespace root          216 Nov  9 04:13 .gitignore
-rw-rw-rw-   1 codespace root          162 Nov  9 04:13 .gitpod.yml
-rw-rw-rw-   1 codespace root           59 Nov  9 04:13 .markdownlint.yml
drwxrwxrwx+  2 codespace root         4096 Nov  9 04:13 .vscode
-rw-rw-rw-   1 codespace root        90232 Nov  9 04:13 AUTHORS.md
-rw-rw-rw-   1 codespace root        48488 Nov  9 04:13 CHANGELOG.md
-rw-rw-rw-   1 codespace root         4171 Nov  9 04:13 CONTRIBUTING.md
-rw-rw-rw-   1 codespace root        25693 Nov 16 03:23 Cargo.lock
-rw-rw-rw-   1 codespace root          629 Nov 16 03:23 Cargo.toml
-rw-rw-rw-   1 codespace root         1095 Nov  9 04:13 LICENSE
-rw-rw-rw-   1 codespace codespace    6554 Nov 16 03:23 README.md
drwxrwxrwx+ 26 codespace root         4096 Nov  9 04:13 exercises
-rw-rw-rw-   1 codespace root         1984 Nov  9 04:13 flake.lock
-rw-rw-rw-   1 codespace root         2338 Nov  9 04:13 flake.nix
-rw-rw-rw-   1 codespace root        43232 Nov  9 04:13 info.toml
-rw-rw-rw-   1 codespace root         3045 Nov  9 04:13 install.ps1
-rwxrwxrwx   1 codespace root         4667 Nov  9 04:13 install.sh
-rw-rw-rw-   1 codespace root          750 Nov  9 04:13 oranda.json
-rw-rw-rw-   1 codespace codespace    9249 Nov 16 03:35 rust-project.json
drwxrwxrwx+ 10 codespace codespace    4096 Nov  9 04:13 rustlings
-rw-rw-rw-   1 codespace root          278 Nov  9 04:13 shell.nix
drwxrwxrwx+  2 codespace root         4096 Nov  9 04:13 src
drwxrwxrwx+  4 codespace codespace    4096 Nov  9 04:13 target
-rwxrwxrwx   1 codespace codespace 7341064 Nov 15 04:59 temp_1719_ThreadId1
drwxrwxrwx+  3 codespace root         4096 Nov  9 04:13 tests

bglebrun avatar Nov 16 '23 04:11 bglebrun

I ran into the same error. This happened after updating my local Rustlings repo but not rebuilding the Rustlings binary. This was because the path of the Clippy exercises changed (https://github.com/rust-lang/rustlings/pull/1727), so my binary tried to access the old path.

So, reinstalling solved the issue.

cargo install --path .

richardstrnad avatar Nov 18 '23 22:11 richardstrnad

I ran into the same error. This happened after updating my local Rustlings repo but not rebuilding the Rustlings binary. This was because the path of the Clippy exercises changed (#1727), so my binary tried to access the old path.

So, reinstalling solved the issue.

cargo install --path .

This solution by @richardstrnad richardstrnad works for the below error too

⠚ Compiling exercises/clippy/clippy1.rs...
thread 'main' panicked at 'Failed to run 'run' command: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/exercise.rs:134:69

Eshan-Sharma avatar May 10 '24 11:05 Eshan-Sharma