Skip to content

Instantly share code, notes, and snippets.

@jackos
Last active March 2, 2024 07:24
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackos/7332fa8ab0b67a87f382fd566696f412 to your computer and use it in GitHub Desktop.
Save jackos/7332fa8ab0b67a87f382fd566696f412 to your computer and use it in GitHub Desktop.

Generating this file is now built into rustlings:

rustlings lsp

For more information on how this file works checkout the Rust Analyzer Manual

{
"sysroot_src": "/home/jacko/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library",
"crates": [
{
"root_module": "exercises/advanced_errors/advanced_errs1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/advanced_errors/advanced_errs2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/clippy/clippy1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/clippy/clippy2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/collections/hashmap1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/collections/hashmap2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/collections/vec1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/collections/vec2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/conversions/as_ref_mut.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/conversions/from_into.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/conversions/from_str.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/conversions/try_from_into.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/conversions/using_as.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/enums/enums1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/enums/enums2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/enums/enums3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/error_handling/errors1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/error_handling/errors2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/error_handling/errors3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/error_handling/errors4.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/error_handling/errors5.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/error_handling/errors6.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/functions/functions1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/functions/functions2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/functions/functions3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/functions/functions4.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/functions/functions5.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/generics/generics1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/generics/generics2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/generics/generics3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/if/if1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/if/if2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/macros/macros1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/macros/macros2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/macros/macros3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/macros/macros4.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/modules/modules1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/modules/modules2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/modules/modules3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/move_semantics/move_semantics1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/move_semantics/move_semantics2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/move_semantics/move_semantics3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/move_semantics/move_semantics4.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/move_semantics/move_semantics5.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/option/option1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/option/option2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/option/option3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/primitive_types/primitive_types1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/primitive_types/primitive_types2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/primitive_types/primitive_types3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/primitive_types/primitive_types4.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/primitive_types/primitive_types5.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/primitive_types/primitive_types6.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/quiz1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/quiz2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/quiz3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/quiz4.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/standard_library_types/arc1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/standard_library_types/box1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/standard_library_types/iterators1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/standard_library_types/iterators2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/standard_library_types/iterators3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/standard_library_types/iterators4.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/standard_library_types/iterators5.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/strings/strings1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/strings/strings2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/structs/structs1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/structs/structs2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/structs/structs3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/tests/tests1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/tests/tests2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/tests/tests3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/threads/threads1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/traits/traits1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/traits/traits2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/variables/variables1.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/variables/variables2.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/variables/variables3.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/variables/variables4.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/variables/variables5.rs",
"edition": "2021",
"deps": []
},
{
"root_module": "exercises/variables/variables6.rs",
"edition": "2021",
"deps": []
}
]
}
@dogweather
Copy link

Thank you!

@peteanning
Copy link

Perfect thank you

@crimx
Copy link

crimx commented Nov 29, 2022

worked like a charm!

@alex-way
Copy link

You are very sexy man

@jackos
Copy link
Author

jackos commented Mar 1, 2023

@alex-way haha thanks!

@Zolmok
Copy link

Zolmok commented Mar 31, 2023

Generating this file is now built into rustlings:
rustlings lsp

I just installed rustlings last night and this doesn't seem to be true. Have they removed this or has it just not made it in quite yet?

❯ rustlings lsp
Unrecognized argument: lsp

Run rustlings --help for more information.

❯ rustlings --help
Usage: rustlings [--nocapture] [-v] [<command>] [<args>]

Rustlings is a collection of small exercises to get you used to writing and reading Rust code

Options:
  --nocapture       show outputs from the test exercises
  -v, --version     show the executable version
  --help            display usage information

Commands:
  verify            Verifies all exercises according to the recommended order
  watch             Reruns `verify` when files were edited
  run               Runs/Tests a single exercise
  hint              Returns a hint for the given exercise
  list              Lists the exercises available in Rustlings

@jackos
Copy link
Author

jackos commented Mar 31, 2023

@Zolmok The version you installed must be older, uninstall it.

To get latest follow the commands in https://github.com/rust-lang/rustlings depending on OS:

Mac/Linux

curl -L https://raw.githubusercontent.com/rust-lang/rustlings/main/install.sh | bash

Windows

Open powershell as admin

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Start-BitsTransfer -Source https://raw.githubusercontent.com/rust-lang/rustlings/main/install.ps1 -Destination $env:TMP/install_rustlings.ps1; Unblock-File $env:TMP/install_rustlings.ps1; Invoke-Expression $env:TMP/install_rustlings.ps1

Which should give you:

❯ rustlings -v
v5.4.1

and:

❯ rustlings --help
...
Commands:
  verify            Verifies all exercises according to the recommended order
  watch             Reruns `verify` when files were edited
  run               Runs/Tests a single exercise
  reset             Resets a single exercise using "git stash -- <filename>"
  hint              Returns a hint for the given exercise
  list              Lists the exercises available in Rustlings
  lsp               Enable rust-analyzer for exercises

@Zolmok
Copy link

Zolmok commented Mar 31, 2023

Very strange, I thought that's what I did. I did it again though and now I have the later version. One thing I changed is from stable to nightly. I wonder if that is the difference? At any rate I have the lsp version now, tyvm!

@jackos
Copy link
Author

jackos commented Apr 1, 2023

@Zolmok no problem happy it works!

@kilogold
Copy link

kilogold commented Jul 4, 2023

Absolute hero. <3

@bkwhite
Copy link

bkwhite commented Nov 16, 2023

so helpful!

@Palanikannan1437
Copy link

Soo nice!!!!!!!!!!!! Thanks so much for this @jackos 🫶

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment