rustlings icon indicating copy to clipboard operation
rustlings copied to clipboard

`n` KeyCode for 'next exercise' not working

Open ndom91 opened this issue 1 year ago • 6 comments

So I've installed rustlings successfully and generated the directory of files. I then started and tried to move on from the first exercise, however pressing n is not having any effect. The first exercise doesn't really require any changes to be able to move on, right? And the second one is just printline -> println, right? I hope I'm not just missing something simple haha.

Anyway, the other keycodes defined here all do work, like h for help or l for list. Once in the list, I can navigate up and down, press c to continue from various exercises, etc.

I tried 6.3.0 with the automatic input recognition as well as 6.2.0 where you apparently have to confirm with Enter, both do not work as expected :thinking:

I'm normally using the latest kitty as a terminal with tmux. But I tried it in kitty without tmux as well as in the latest alacritty with and without tmux, all with the same issue.

Anything else I can provide to help debug?

ndom91 avatar Sep 14 '24 17:09 ndom91

Okay, I got it working, but I am not any smarter because of it :joy:

So I'm using NixOS and I had rustc and cargo manually installed initially. When I removed those and installed rustup from nixpkgs and installed the latest stable rust toolchain from rustup, and then tried rustlings (latest version, 6.3.0) again, it worked!

Previously I also wasn't even shown the n button hint below the progress bar, but now I am and it works as expected.

ndom91 avatar Sep 14 '24 17:09 ndom91

Huh, weird. If we can reproduce it, maybe we could exit with a helpful message.

mo8it avatar Sep 15 '24 02:09 mo8it

you probably didn't have clippy in PATH (it shows an error while its running). nix shell nixpkgs#clippy fixed it. (at least that was the problem for me)

FlafyDev avatar Sep 27 '24 21:09 FlafyDev

I have the same issue. I installed cargo, rust-analyzer and rustc from nixpkgs and did not install clippy. I installed rustlings via cargo install rustlings.

Some notes for myself:

  1. rust-analyzer is only mentioned once in the README under 'Working Environment' / 'Editor' and the wording suggests, that it is not a requirement. clippy is not mentioned at all in the README.
  2. I don't understand, how the availability of clippy can influence the working of the 'n' key.
  3. cargo search cargo-clippy finds cargo-clippy with version 0.0.0 which looks very dubious.
  4. cargo info cargo-clippy gives: error: could not find cargo-clippy in registry `https://github.com/rust-lang/crates.io-index
  5. https://crates.io/crates/cargo-clippy says it has been yanked.
  6. This resource seem to be up to date: https://github.com/rust-lang/rust-clippy
  7. After installing clippy from nixpkgs, and going to exercise 2 and back to 1, the next key was advertised and worked, even without restarting the rustlings binary.

thkoch2001 avatar Nov 24 '24 12:11 thkoch2001

A quick search for "Clippy install Rust" in DuckDuckGo leads to https://doc.rust-lang.org/clippy/installation.html which shows you the default installation method:

rustup component add clippy [--toolchain=<name>]

There is a link to how to compile it from source. Could be helpful if you don't want to use rustup.

You don't even need to do that if you installed Rust with rustup, the recommended way of installing Rust (also mentioned in the README). rustup installs Clippy by default.

Now, the problem is that you aren't using rustup. I am not familiar with Nix and will not solve problems related to it. This is not a Rustlings issue.

I am reopening the issue to check for the availability of Clippy on initialization. I won't be able to get to it before 04.12. though.

mo8it avatar Nov 24 '24 17:11 mo8it

For any fedora-linux users that have the same issue and followed the fedora-docs, maybe you haven't installed the rust depencies via rustup which is the cause of the error. Follow the second option in the docs to install via rustup

BinaryFly avatar Apr 29 '25 19:04 BinaryFly

Done in https://github.com/rust-lang/rustlings/commit/f24861957a0c669060473a1fe7c6180eb43df9e2

mo8it avatar Jul 04 '25 21:07 mo8it