Compare commits

..

111 commits

Author SHA1 Message Date
mo8it c613b70363 Print the trimmed final message 2024-04-14 17:28:01 +02:00
Mo dc02c38a94
Merge pull request #1942 from rust-lang/tui
TUI
2024-04-14 17:13:32 +02:00
mo8it 7526c6b1f9 Update POST_INIT_MSG 2024-04-14 17:11:27 +02:00
mo8it 1cbabc3d28 Add the manual-run option 2024-04-14 17:10:53 +02:00
mo8it bd10b154fe Clear the terminal after showing the welcome message 2024-04-14 16:07:17 +02:00
mo8it 070a780d7f Trim the final message 2024-04-14 16:04:05 +02:00
mo8it 8aef915ee7 Show the welcome message 2024-04-14 16:03:49 +02:00
mo8it 3da860927d Use push instead of extend_from_slice on chars 2024-04-14 14:53:32 +02:00
mo8it 1c90575b9f Update deps 2024-04-14 05:13:50 +02:00
mo8it 9dcc4b7df5 Simplify the state file 2024-04-14 05:13:27 +02:00
mo8it 9831cbb139 Fix tests 2024-04-14 03:13:33 +02:00
mo8it bee62c89de Add terminal links 2024-04-14 02:41:19 +02:00
mo8it 5c0073a948 Tolerate changes in the state file 2024-04-14 01:15:43 +02:00
mo8it 2a26dfcb00 Remove unused ContextLine 2024-04-13 15:30:35 +02:00
mo8it 24539666af Show the final message 2024-04-12 20:06:56 +02:00
mo8it 757723a7e8 Add missing newline 2024-04-12 19:30:36 +02:00
mo8it ff4c752984 Print FAILED 2024-04-12 19:30:29 +02:00
mo8it 06d1089714 Set pending on fail in run mode 2024-04-12 19:24:26 +02:00
mo8it 6e827da570 It doesn't take minutes :P 2024-04-12 19:18:16 +02:00
mo8it 279ebdc153 Remove the modifier filter in the list mode 2024-04-12 19:16:52 +02:00
mo8it 9b0eeb815a Fix Display for Exercise 2024-04-12 19:07:17 +02:00
mo8it 44824718b2 Remove unused import 2024-04-12 18:58:01 +02:00
mo8it 8bd03093eb Add newline at the end of the generated .gitignore 2024-04-12 18:57:39 +02:00
mo8it d5a6dee1b3 Handle the case when all exercises are done 2024-04-12 18:57:04 +02:00
mo8it a534de0312 Implement going to the next exercise 2024-04-12 15:27:29 +02:00
mo8it 98c5088a39 Update deps 2024-04-12 14:52:50 +02:00
mo8it 6807e63c5f Show done message 2024-04-12 02:45:54 +02:00
mo8it 2a95a3e966 Deal with long strings 2024-04-12 01:24:01 +02:00
mo8it 1e3745ccdf Update winnow 2024-04-12 00:58:26 +02:00
mo8it d8160f9113 Remove outdated installation methods 2024-04-12 00:56:40 +02:00
mo8it 6494a8c50b Remove the watch subcommand 2024-04-11 16:54:27 +02:00
mo8it 864cfa725b Remove outdated tests 2024-04-11 15:10:15 +02:00
mo8it e79bc727f0 Don't listen on keys with modifiers 2024-04-11 15:08:46 +02:00
mo8it 2e1a87d7d3 Take care of filters when resolving the selected exercise 2024-04-11 14:58:56 +02:00
mo8it f53a0e8700 Panic if there are no exercises 2024-04-11 14:39:19 +02:00
mo8it 470dc65956 Fix selected when there are no rows 2024-04-11 14:35:30 +02:00
mo8it 686143100f Update intro1 2024-04-11 02:55:58 +02:00
mo8it c3933904f6 Update deps 2024-04-11 02:51:50 +02:00
mo8it 65849629f5 Remove glob 2024-04-11 02:51:23 +02:00
mo8it fa1f239a70 Remove "I AM NOT DONE" and the verify mode and add AppState 2024-04-11 02:51:02 +02:00
mo8it 4bb6bda9f6 Separate event handlers 2024-04-10 16:02:12 +02:00
mo8it 256c4013b7 Keep hint displayed after resizing the terminal 2024-04-10 15:56:38 +02:00
mo8it 27e9520665 Add deny_unknown_fields 2024-04-10 14:40:49 +02:00
mo8it b3642b0219 Remove todo 2024-04-10 14:35:42 +02:00
mo8it 193e0a03b2 Use light blue for the message 2024-04-10 14:31:08 +02:00
mo8it a59acf8835 Show the current exercise path 2024-04-10 14:29:31 +02:00
mo8it 62e92476e6 Fix typo 2024-04-10 04:10:05 +02:00
mo8it 6255efe8b2 Show the invalid command to avoid confusion after resizing the terminal 2024-04-10 04:08:40 +02:00
mo8it a46d66134b Fix shift of first output line 2024-04-10 03:56:41 +02:00
mo8it f034899c7f Capture terminal resize events 2024-04-10 03:54:48 +02:00
mo8it c9a5fa6097 Accept repeat keyboard events 2024-04-10 02:19:14 +02:00
mo8it d1a965f019 Make the list mode part of the watch mode 2024-04-10 02:12:50 +02:00
mo8it 533a009257 Show the progress in the progress bar, not the current exercise index 2024-04-10 00:51:41 +02:00
mo8it 4a80bf6441 Colorize the progress bar 2024-04-10 00:42:32 +02:00
mo8it c8d217ad50 Fix showing stdout and stderr 2024-04-09 22:20:12 +02:00
mo8it a8ddc07a9a Add "exercises" to the end of the progress bar 2024-04-09 22:15:41 +02:00
mo8it af85f2036c Print a newline before the progress bar 2024-04-09 22:06:55 +02:00
mo8it ff6c15f9c1 Don't try to join the input thread 2024-04-09 22:04:10 +02:00
mo8it 4110ae21af Handle notify errors 2024-04-09 21:46:55 +02:00
mo8it b15e0a279b Use shrink to fit before leaking the vector 2024-04-09 21:23:02 +02:00
mo8it 787bec9875 Use exercises as leaked 2024-04-09 21:16:27 +02:00
mo8it f0ce2c1afa Improve event handling in the watch mode 2024-04-09 21:07:53 +02:00
mo8it 850c1d0234 Add progress bar to list 2024-04-09 19:37:39 +02:00
mo8it ee7d976283 Use a green color on successful run 2024-04-09 17:15:12 +02:00
mo8it d0fcd8ae8a Use a color for the message 2024-04-08 03:21:13 +02:00
mo8it 7c46e7ac69 Simplify building rows.
No more lifetimes championship :(
2024-04-08 03:16:38 +02:00
mo8it 1db5de9653 Fix selection after applying filters 2024-04-08 03:08:05 +02:00
mo8it b5fc06bd56 Show more exercises before the selected one 2024-04-08 02:46:35 +02:00
mo8it 7c4d33654f Implement done/pending filters 2024-04-08 02:41:48 +02:00
mo8it 05729b27a0 Set a list offset 2024-04-08 01:49:38 +02:00
mo8it 0bf3f7e01f Lowercase "filter" in help footer 2024-04-08 01:34:41 +02:00
mo8it bd5503a0d3 Show message on reset 2024-04-08 01:33:11 +02:00
mo8it 25e855a009 Merge imports 2024-04-08 00:36:26 +02:00
mo8it c2501ae733 Remove list tests because of the TUI 2024-04-08 00:36:10 +02:00
mo8it 3a4f2bebb4 Remove test because of defaulting to watch mode 2024-04-08 00:35:51 +02:00
mo8it 394ca402a8 Remove the info_toml_content field 2024-04-07 23:57:54 +02:00
mo8it db25cc9157 Ignore .rustlings-state.json 2024-04-07 23:54:32 +02:00
mo8it 93f8d1610d Some renamings 2024-04-07 23:37:40 +02:00
mo8it 99c9ab467b Implement resetting 2024-04-07 22:43:59 +02:00
mo8it db43efe3ec Update .gitignore 2024-04-07 22:40:50 +02:00
mo8it 9a4ee47c52 Separate WatchState 2024-04-07 19:29:16 +02:00
mo8it 0a674a158d Separate UiState 2024-04-07 19:05:29 +02:00
mo8it 3bd26c7a24 State -> StateFile 2024-04-07 19:01:08 +02:00
mo8it 8c31d38fa1 Better variable name 2024-04-07 17:57:20 +02:00
mo8it d988054ad8 Add UiState 2024-04-07 16:33:00 +02:00
mo8it 2db86833a9 Fix lifetimes 2024-04-07 13:12:40 +02:00
mo8it b0a4750624 Implement "continue at" 2024-04-07 04:59:22 +02:00
mo8it 4f69285375 Shorten the help footer 2024-04-07 04:39:03 +02:00
mo8it e640b4a1ff Add "Next" column 2024-04-07 04:36:27 +02:00
mo8it 7f5a18fa34 Show help message 2024-04-07 04:19:50 +02:00
mo8it c4897139ae Prevent unneeded redraws 2024-04-07 03:41:23 +02:00
mo8it 372290a796 Done navigation 2024-04-07 03:38:18 +02:00
mo8it 729385362c Update deps 2024-04-07 03:03:59 +02:00
mo8it f6db88aca8 Started with list 2024-04-07 03:03:37 +02:00
mo8it 0819bbe21f Can't use Ratatui for the watch mode :( 2024-04-07 01:17:53 +02:00
mo8it 18342b3aa3 Verify starting with some index 2024-04-07 01:16:56 +02:00
mo8it c2daad8340 Return an error instead of exiting 2024-04-07 01:15:47 +02:00
mo8it de9a0ed522 Update state 2024-04-06 01:46:22 +02:00
mo8it 06e7216c83 Elimintate an itermediate variable 2024-04-06 01:46:09 +02:00
mo8it 60155294e9 Rename packages 2024-04-06 01:45:54 +02:00
mo8it 3f2d41de9e Start with the state 2024-04-05 03:05:07 +02:00
mo8it b0f19fd862 Start with the TUI 2024-04-05 03:04:53 +02:00
mo8it 0bf51c6a0d Ignore .ignore 2024-04-05 00:59:21 +02:00
mo8it 1d2c2cffd2 Remove .gitattributes 2024-04-05 00:59:13 +02:00
mo8it 157fe016e5 Remove ui.rs 2024-04-05 00:49:22 +02:00
mo8it 5a233398eb Fix tests 2024-04-05 00:44:43 +02:00
mo8it 919ba88413 Use the pretty format when testing even with -q 2024-04-05 00:43:36 +02:00
mo8it 445441ce25 Make gen-dev-cargo-toml a separate package
so that `cargo install` only installs `rustlings`
2024-04-04 23:16:57 +02:00
mo8it 34375b2ebf Clean up as a preparation for the TUI 2024-04-04 21:06:11 +02:00
mo8it 9ea744a710 Remove deps not needed in the TUI 2024-04-04 20:27:30 +02:00
mo8it 2b6f9fb6a7 Add Ratatui 2024-04-04 20:21:55 +02:00
139 changed files with 2044 additions and 1859 deletions

View file

@ -1,8 +0,0 @@
{
"image": "mcr.microsoft.com/devcontainers/rust:1",
"updateContentCommand": ["cargo", "build"],
"postAttachCommand": ["rustlings", "watch"],
"remoteEnv": {
"PATH": "${containerEnv:PATH}:${containerWorkspaceFolder}/target/debug"
}
}

2
.gitattributes vendored
View file

@ -1,2 +0,0 @@
* text=auto
*.sh text eol=lf

27
.gitignore vendored
View file

@ -1,18 +1,23 @@
# Cargo
target/ target/
/tests/fixture/*/Cargo.lock /tests/fixture/*/Cargo.lock
/dev/Cargo.lock /dev/Cargo.lock
*.swp # State file
**/*.rs.bk .rustlings-state.txt
.DS_Store
*.pdb # oranda
.idea
.vscode/*
!.vscode/extensions.json
*.iml
*.o
public/ public/
.netlify
# OS
.DS_Store
.direnv/ .direnv/
# Local Netlify folder # Editor
.netlify *.swp
.idea
*.iml
# Ignore file for editors like Helix
.ignore

View file

@ -1,7 +0,0 @@
tasks:
- init: /workspace/rustlings/install.sh
command: /workspace/.cargo/bin/rustlings watch
vscode:
extensions:
- rust-lang.rust-analyzer@0.3.1348

View file

@ -1,5 +0,0 @@
{
"recommendations": [
"rust-lang.rust-analyzer"
]
}

442
Cargo.lock generated
View file

@ -2,6 +2,18 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "ahash"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
dependencies = [
"cfg-if",
"once_cell",
"version_check",
"zerocopy",
]
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "1.1.3" version = "1.1.3"
@ -11,6 +23,12 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "allocator-api2"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
[[package]] [[package]]
name = "anstream" name = "anstream"
version = "0.6.13" version = "0.6.13"
@ -61,9 +79,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.81" version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519"
[[package]] [[package]]
name = "assert_cmd" name = "assert_cmd"
@ -109,6 +127,21 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "cassowary"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
[[package]]
name = "castaway"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc"
dependencies = [
"rustversion",
]
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.0" version = "1.0.0"
@ -143,10 +176,10 @@ version = "4.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64"
dependencies = [ dependencies = [
"heck", "heck 0.5.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.58",
] ]
[[package]] [[package]]
@ -162,16 +195,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]] [[package]]
name = "console" name = "compact_str"
version = "0.15.8" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f"
dependencies = [ dependencies = [
"encode_unicode", "castaway",
"lazy_static", "cfg-if",
"libc", "itoa",
"unicode-width", "ryu",
"windows-sys 0.52.0", "static_assertions",
] ]
[[package]] [[package]]
@ -189,6 +222,31 @@ version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
[[package]]
name = "crossterm"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
dependencies = [
"bitflags 2.5.0",
"crossterm_winapi",
"libc",
"mio",
"parking_lot",
"signal-hook",
"signal-hook-mio",
"winapi",
]
[[package]]
name = "crossterm_winapi"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "difflib" name = "difflib"
version = "0.4.0" version = "0.4.0"
@ -203,15 +261,9 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]] [[package]]
name = "either" name = "either"
version = "1.10.0" version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2"
[[package]]
name = "encode_unicode"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
[[package]] [[package]]
name = "equivalent" name = "equivalent"
@ -260,16 +312,29 @@ dependencies = [
] ]
[[package]] [[package]]
name = "glob" name = "gen-dev-cargo-toml"
version = "0.3.1" version = "0.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" "anyhow",
"serde",
"toml_edit",
]
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.14.3" version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
dependencies = [
"ahash",
"allocator-api2",
]
[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]] [[package]]
name = "heck" name = "heck"
@ -297,17 +362,10 @@ dependencies = [
] ]
[[package]] [[package]]
name = "indicatif" name = "indoc"
version = "0.17.8" version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
dependencies = [
"console",
"instant",
"number_prefix",
"portable-atomic",
"unicode-width",
]
[[package]] [[package]]
name = "inotify" name = "inotify"
@ -330,12 +388,12 @@ dependencies = [
] ]
[[package]] [[package]]
name = "instant" name = "itertools"
version = "0.1.12" version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
dependencies = [ dependencies = [
"cfg-if", "either",
] ]
[[package]] [[package]]
@ -364,12 +422,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.153" version = "0.2.153"
@ -382,6 +434,16 @@ version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
[[package]]
name = "lock_api"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.21" version = "0.4.21"
@ -389,10 +451,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
[[package]] [[package]]
name = "memchr" name = "lru"
version = "2.7.1" version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc"
dependencies = [
"hashbrown",
]
[[package]]
name = "memchr"
version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]] [[package]]
name = "mio" name = "mio"
@ -452,16 +523,39 @@ dependencies = [
] ]
[[package]] [[package]]
name = "number_prefix" name = "once_cell"
version = "0.4.0" version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]] [[package]]
name = "portable-atomic" name = "parking_lot"
version = "1.6.0" version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-targets 0.48.5",
]
[[package]]
name = "paste"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
[[package]] [[package]]
name = "predicates" name = "predicates"
@ -504,13 +598,33 @@ dependencies = [
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.35" version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "ratatui"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcb12f8fbf6c62614b0d56eb352af54f6a22410c3b079eb53ee93c7b97dd31d8"
dependencies = [
"bitflags 2.5.0",
"cassowary",
"compact_str",
"crossterm",
"indoc",
"itertools",
"lru",
"paste",
"stability",
"strum",
"unicode-segmentation",
"unicode-width",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.4.1" version = "0.4.1"
@ -569,18 +683,15 @@ dependencies = [
"anyhow", "anyhow",
"assert_cmd", "assert_cmd",
"clap", "clap",
"console", "crossterm",
"glob", "hashbrown",
"indicatif",
"notify-debouncer-mini", "notify-debouncer-mini",
"predicates", "predicates",
"ratatui",
"rustlings-macros", "rustlings-macros",
"serde", "serde",
"serde_json",
"shlex",
"toml_edit", "toml_edit",
"which", "which",
"winnow",
] ]
[[package]] [[package]]
@ -590,6 +701,12 @@ dependencies = [
"quote", "quote",
] ]
[[package]]
name = "rustversion"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47"
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.17" version = "1.0.17"
@ -605,6 +722,12 @@ dependencies = [
"winapi-util", "winapi-util",
] ]
[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.197" version = "1.0.197"
@ -622,18 +745,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn 2.0.58",
]
[[package]]
name = "serde_json"
version = "1.0.115"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd"
dependencies = [
"itoa",
"ryu",
"serde",
] ]
[[package]] [[package]]
@ -646,22 +758,101 @@ dependencies = [
] ]
[[package]] [[package]]
name = "shlex" name = "signal-hook"
version = "1.3.0" version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801"
dependencies = [
"libc",
"signal-hook-registry",
]
[[package]]
name = "signal-hook-mio"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af"
dependencies = [
"libc",
"mio",
"signal-hook",
]
[[package]]
name = "signal-hook-registry"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
dependencies = [
"libc",
]
[[package]]
name = "smallvec"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "stability"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebd1b177894da2a2d9120208c3386066af06a488255caabc5de8ddca22dbc3ce"
dependencies = [
"quote",
"syn 1.0.109",
]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.11.0" version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "strum"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29"
dependencies = [
"strum_macros",
]
[[package]]
name = "strum_macros"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946"
dependencies = [
"heck 0.4.1",
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.58",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.55" version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -702,6 +893,12 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-segmentation"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.1.11" version = "0.1.11"
@ -714,6 +911,12 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]] [[package]]
name = "wait-timeout" name = "wait-timeout"
version = "0.2.0" version = "0.2.0"
@ -797,7 +1000,7 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [ dependencies = [
"windows-targets 0.52.4", "windows-targets 0.52.5",
] ]
[[package]] [[package]]
@ -817,17 +1020,18 @@ dependencies = [
[[package]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.52.4" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
dependencies = [ dependencies = [
"windows_aarch64_gnullvm 0.52.4", "windows_aarch64_gnullvm 0.52.5",
"windows_aarch64_msvc 0.52.4", "windows_aarch64_msvc 0.52.5",
"windows_i686_gnu 0.52.4", "windows_i686_gnu 0.52.5",
"windows_i686_msvc 0.52.4", "windows_i686_gnullvm",
"windows_x86_64_gnu 0.52.4", "windows_i686_msvc 0.52.5",
"windows_x86_64_gnullvm 0.52.4", "windows_x86_64_gnu 0.52.5",
"windows_x86_64_msvc 0.52.4", "windows_x86_64_gnullvm 0.52.5",
"windows_x86_64_msvc 0.52.5",
] ]
[[package]] [[package]]
@ -838,9 +1042,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_gnullvm"
version = "0.52.4" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
@ -850,9 +1054,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.52.4" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
@ -862,9 +1066,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.52.4" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
@ -874,9 +1084,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.52.4" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
@ -886,9 +1096,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.52.4" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
[[package]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
@ -898,9 +1108,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
version = "0.52.4" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
@ -910,15 +1120,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.52.4" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.6.5" version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -928,3 +1138,23 @@ name = "winsafe"
version = "0.0.19" version = "0.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904"
[[package]]
name = "zerocopy"
version = "0.7.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.58",
]

View file

@ -6,6 +6,9 @@ exclude = [
"tests/fixture/success", "tests/fixture/success",
"dev", "dev",
] ]
members = [
"gen-dev-cargo-toml",
]
[workspace.package] [workspace.package]
version = "6.0.0" version = "6.0.0"
@ -16,6 +19,11 @@ authors = [
license = "MIT" license = "MIT"
edition = "2021" edition = "2021"
[workspace.dependencies]
anyhow = "1.0.82"
serde = { version = "1.0.197", features = ["derive"] }
toml_edit = { version = "0.22.9", default-features = false, features = ["parse", "serde"] }
[package] [package]
name = "rustlings" name = "rustlings"
description = "Small exercises to get you used to reading and writing Rust code!" description = "Small exercises to get you used to reading and writing Rust code!"
@ -26,22 +34,19 @@ license.workspace = true
edition.workspace = true edition.workspace = true
[dependencies] [dependencies]
anyhow = "1.0.81" anyhow.workspace = true
clap = { version = "4.5.4", features = ["derive"] } clap = { version = "4.5.4", features = ["derive"] }
console = "0.15.8" crossterm = "0.27.0"
indicatif = "0.17.8" hashbrown = "0.14.3"
notify-debouncer-mini = "0.4.1" notify-debouncer-mini = "0.4.1"
ratatui = "0.26.1"
rustlings-macros = { path = "rustlings-macros" } rustlings-macros = { path = "rustlings-macros" }
serde_json = "1.0.115" serde.workspace = true
serde = { version = "1.0.197", features = ["derive"] } toml_edit.workspace = true
shlex = "1.3.0"
toml_edit = { version = "0.22.9", default-features = false, features = ["parse", "serde"] }
which = "6.0.1" which = "6.0.1"
winnow = "0.6.5"
[dev-dependencies] [dev-dependencies]
assert_cmd = "2.0.14" assert_cmd = "2.0.14"
glob = "0.3.0"
predicates = "3.1.0" predicates = "3.1.0"
[profile.release] [profile.release]

View file

@ -18,78 +18,7 @@ _Note: If you're on Linux, make sure you've installed gcc. Deb: `sudo apt instal
You will need to have Rust installed. You can get it by visiting <https://rustup.rs>. This'll also install Cargo, Rust's package/project manager. You will need to have Rust installed. You can get it by visiting <https://rustup.rs>. This'll also install Cargo, Rust's package/project manager.
## MacOS/Linux <!-- TODO: Installation with Cargo -->
Just run:
```bash
curl -L https://raw.githubusercontent.com/rust-lang/rustlings/main/install.sh | bash
```
Or if you want it to be installed to a different path:
```bash
curl -L https://raw.githubusercontent.com/rust-lang/rustlings/main/install.sh | bash -s mypath/
```
This will install Rustlings and give you access to the `rustlings` command. Run it to get started!
### Nix
Basically: Clone the repository at the latest tag, finally run `nix develop` or `nix-shell`.
```bash
# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 5.6.1)
git clone -b 5.6.1 --depth 1 https://github.com/rust-lang/rustlings
cd rustlings
# if nix version > 2.3
nix develop
# if nix version <= 2.3
nix-shell
```
## Windows
In PowerShell (Run as Administrator), set `ExecutionPolicy` to `RemoteSigned`:
```ps1
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
```
Then, you can run:
```ps1
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
```
To install Rustlings. Same as on MacOS/Linux, you will have access to the `rustlings` command after it. Keep in mind that this works best in PowerShell, and any other terminals may give you errors.
If you get a permission denied message, you might have to exclude the directory where you cloned Rustlings in your antivirus.
## Browser
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/rust-lang/rustlings)
[![Open Rustlings On Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new/?repo=rust-lang%2Frustlings&ref=main)
## Manually
Basically: Clone the repository at the latest tag, run `cargo install --path .`.
```bash
# find out the latest version at https://github.com/rust-lang/rustlings/releases/latest (on edit 5.6.1)
git clone -b 5.6.1 --depth 1 https://github.com/rust-lang/rustlings
cd rustlings
cargo install --force --path .
```
If there are installation errors, ensure that your toolchain is up to date. For the latest, run:
```bash
rustup update
```
Then, same as above, run `rustlings` to get started.
## Doing exercises ## Doing exercises
@ -101,13 +30,7 @@ The task is simple. Most exercises contain an error that keeps them from compili
rustlings watch rustlings watch
``` ```
This will try to verify the completion of every exercise in a predetermined order (what we think is best for newcomers). It will also rerun automatically every time you change a file in the `exercises/` directory. If you want to only run it once, you can use: This will try to verify the completion of every exercise in a predetermined order (what we think is best for newcomers). It will also rerun automatically every time you change a file in the `exercises/` directory.
```bash
rustlings verify
```
This will do the same as watch, but it'll quit after running.
In case you want to go by your own order, or want to only verify a single exercise, you can run: In case you want to go by your own order, or want to only verify a single exercise, you can run:
@ -144,10 +67,6 @@ rustlings list
After every couple of sections, there will be a quiz that'll test your knowledge on a bunch of sections at once. These quizzes are found in `exercises/quizN.rs`. After every couple of sections, there will be a quiz that'll test your knowledge on a bunch of sections at once. These quizzes are found in `exercises/quizN.rs`.
## Enabling `rust-analyzer`
Run the command `rustlings lsp` which will generate a `rust-project.json` at the root of the project, this allows [rust-analyzer](https://rust-analyzer.github.io/) to parse each exercise.
## Continuing On ## Continuing On
Once you've completed Rustlings, put your new knowledge to good use! Continue practicing your Rust skills by building your own projects, contributing to Rustlings, or finding other open-source projects to contribute to. Once you've completed Rustlings, put your new knowledge to good use! Continue practicing your Rust skills by building your own projects, contributing to Rustlings, or finding other open-source projects to contribute to.

View file

@ -1,5 +1,5 @@
# This file is a hack to allow using `cargo r` to test `rustlings` during development. # This file is a hack to allow using `cargo run` to test `rustlings` during development.
# You shouldn't edit it manually. It is created and updated by running `cargo run --bin gen-dev-cargo-toml`. # You shouldn't edit it manually. It is created and updated by running `cargo run -p gen-dev-cargo-toml`.
bin = [ bin = [
{ name = "intro1", path = "../exercises/00_intro/intro1.rs" }, { name = "intro1", path = "../exercises/00_intro/intro1.rs" },
@ -101,6 +101,6 @@ bin = [
] ]
[package] [package]
name = "rustlings" name = "rustlings-dev"
edition = "2021" edition = "2021"
publish = false publish = false

View file

@ -1,6 +1,5 @@
// intro1.rs // intro1.rs
// //
// About this `I AM NOT DONE` thing:
// We sometimes encourage you to keep trying things on a given exercise, even // We sometimes encourage you to keep trying things on a given exercise, even
// after you already figured it out. If you got everything working and feel // after you already figured it out. If you got everything working and feel
// ready for the next exercise, remove the `I AM NOT DONE` comment below. // ready for the next exercise, remove the `I AM NOT DONE` comment below.
@ -13,8 +12,6 @@
// Execute `rustlings hint intro1` or use the `hint` watch subcommand for a // Execute `rustlings hint intro1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
println!("Hello and"); println!("Hello and");
println!(r#" welcome to... "#); println!(r#" welcome to... "#);
@ -29,13 +26,6 @@ fn main() {
println!("or logic error. The central concept behind Rustlings is to fix these errors and"); println!("or logic error. The central concept behind Rustlings is to fix these errors and");
println!("solve the exercises. Good luck!"); println!("solve the exercises. Good luck!");
println!(); println!();
println!("The source for this exercise is in `exercises/00_intro/intro1.rs`. Have a look!"); println!("The file of this exercise is `exercises/00_intro/intro1.rs`. Have a look!");
println!( println!("The current exercise path is shown under the progress bar in the watch mode.");
"Going forward, the source of the exercises will always be in the success/failure output."
);
println!();
println!(
"If you want to use rust-analyzer, Rust's LSP implementation, make sure your editor is set"
);
println!("up, and then run `rustlings lsp` before continuing.")
} }

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint intro2` or use the `hint` watch subcommand for a // Execute `rustlings hint intro2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
printline!("Hello there!") printline!("Hello there!")
} }

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint variables1` or use the `hint` watch subcommand for a // Execute `rustlings hint variables1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
x = 5; x = 5;
println!("x has the value {}", x); println!("x has the value {}", x);

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint variables2` or use the `hint` watch subcommand for a // Execute `rustlings hint variables2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
let x; let x;
if x == 10 { if x == 10 {

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint variables3` or use the `hint` watch subcommand for a // Execute `rustlings hint variables3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
let x: i32; let x: i32;
println!("Number {}", x); println!("Number {}", x);

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint variables4` or use the `hint` watch subcommand for a // Execute `rustlings hint variables4` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
let x = 3; let x = 3;
println!("Number {}", x); println!("Number {}", x);

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint variables5` or use the `hint` watch subcommand for a // Execute `rustlings hint variables5` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
let number = "T-H-R-E-E"; // don't change this line let number = "T-H-R-E-E"; // don't change this line
println!("Spell a Number : {}", number); println!("Spell a Number : {}", number);

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint variables6` or use the `hint` watch subcommand for a // Execute `rustlings hint variables6` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
const NUMBER = 3; const NUMBER = 3;
fn main() { fn main() {
println!("Number {}", NUMBER); println!("Number {}", NUMBER);

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint functions1` or use the `hint` watch subcommand for a // Execute `rustlings hint functions1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
call_me(); call_me();
} }

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint functions2` or use the `hint` watch subcommand for a // Execute `rustlings hint functions2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
call_me(3); call_me(3);
} }

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint functions3` or use the `hint` watch subcommand for a // Execute `rustlings hint functions3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
call_me(); call_me();
} }

View file

@ -8,8 +8,6 @@
// Execute `rustlings hint functions4` or use the `hint` watch subcommand for a // Execute `rustlings hint functions4` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
let original_price = 51; let original_price = 51;
println!("Your sale price is {}", sale_price(original_price)); println!("Your sale price is {}", sale_price(original_price));

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint functions5` or use the `hint` watch subcommand for a // Execute `rustlings hint functions5` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
let answer = square(3); let answer = square(3);
println!("The square of 3 is {}", answer); println!("The square of 3 is {}", answer);

View file

@ -2,8 +2,6 @@
// //
// Execute `rustlings hint if1` or use the `hint` watch subcommand for a hint. // Execute `rustlings hint if1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
pub fn bigger(a: i32, b: i32) -> i32 { pub fn bigger(a: i32, b: i32) -> i32 {
// Complete this function to return the bigger number! // Complete this function to return the bigger number!
// If both numbers are equal, any of them can be returned. // If both numbers are equal, any of them can be returned.

View file

@ -5,8 +5,6 @@
// //
// Execute `rustlings hint if2` or use the `hint` watch subcommand for a hint. // Execute `rustlings hint if2` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
pub fn foo_if_fizz(fizzish: &str) -> &str { pub fn foo_if_fizz(fizzish: &str) -> &str {
if fizzish == "fizz" { if fizzish == "fizz" {
"foo" "foo"

View file

@ -2,8 +2,6 @@
// //
// Execute `rustlings hint if3` or use the `hint` watch subcommand for a hint. // Execute `rustlings hint if3` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
pub fn animal_habitat(animal: &str) -> &'static str { pub fn animal_habitat(animal: &str) -> &'static str {
let identifier = if animal == "crab" { let identifier = if animal == "crab" {
1 1

View file

@ -3,8 +3,6 @@
// Fill in the rest of the line that has code missing! No hints, there's no // Fill in the rest of the line that has code missing! No hints, there's no
// tricks, just get used to typing these :) // tricks, just get used to typing these :)
// I AM NOT DONE
fn main() { fn main() {
// Booleans (`bool`) // Booleans (`bool`)

View file

@ -3,8 +3,6 @@
// Fill in the rest of the line that has code missing! No hints, there's no // Fill in the rest of the line that has code missing! No hints, there's no
// tricks, just get used to typing these :) // tricks, just get used to typing these :)
// I AM NOT DONE
fn main() { fn main() {
// Characters (`char`) // Characters (`char`)

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint primitive_types3` or use the `hint` watch subcommand // Execute `rustlings hint primitive_types3` or use the `hint` watch subcommand
// for a hint. // for a hint.
// I AM NOT DONE
fn main() { fn main() {
let a = ??? let a = ???

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint primitive_types4` or use the `hint` watch subcommand // Execute `rustlings hint primitive_types4` or use the `hint` watch subcommand
// for a hint. // for a hint.
// I AM NOT DONE
#[test] #[test]
fn slice_out_of_array() { fn slice_out_of_array() {
let a = [1, 2, 3, 4, 5]; let a = [1, 2, 3, 4, 5];

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint primitive_types5` or use the `hint` watch subcommand // Execute `rustlings hint primitive_types5` or use the `hint` watch subcommand
// for a hint. // for a hint.
// I AM NOT DONE
fn main() { fn main() {
let cat = ("Furry McFurson", 3.5); let cat = ("Furry McFurson", 3.5);
let /* your pattern here */ = cat; let /* your pattern here */ = cat;

View file

@ -6,8 +6,6 @@
// Execute `rustlings hint primitive_types6` or use the `hint` watch subcommand // Execute `rustlings hint primitive_types6` or use the `hint` watch subcommand
// for a hint. // for a hint.
// I AM NOT DONE
#[test] #[test]
fn indexing_tuple() { fn indexing_tuple() {
let numbers = (1, 2, 3); let numbers = (1, 2, 3);

View file

@ -7,8 +7,6 @@
// //
// Execute `rustlings hint vecs1` or use the `hint` watch subcommand for a hint. // Execute `rustlings hint vecs1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
fn array_and_vec() -> ([i32; 4], Vec<i32>) { fn array_and_vec() -> ([i32; 4], Vec<i32>) {
let a = [10, 20, 30, 40]; // a plain array let a = [10, 20, 30, 40]; // a plain array
let v = // TODO: declare your vector here with the macro for vectors let v = // TODO: declare your vector here with the macro for vectors

View file

@ -7,8 +7,6 @@
// //
// Execute `rustlings hint vecs2` or use the `hint` watch subcommand for a hint. // Execute `rustlings hint vecs2` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
fn vec_loop(mut v: Vec<i32>) -> Vec<i32> { fn vec_loop(mut v: Vec<i32>) -> Vec<i32> {
for element in v.iter_mut() { for element in v.iter_mut() {
// TODO: Fill this up so that each element in the Vec `v` is // TODO: Fill this up so that each element in the Vec `v` is

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint move_semantics1` or use the `hint` watch subcommand // Execute `rustlings hint move_semantics1` or use the `hint` watch subcommand
// for a hint. // for a hint.
// I AM NOT DONE
#[test] #[test]
fn main() { fn main() {
let vec0 = vec![22, 44, 66]; let vec0 = vec![22, 44, 66];

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint move_semantics2` or use the `hint` watch subcommand // Execute `rustlings hint move_semantics2` or use the `hint` watch subcommand
// for a hint. // for a hint.
// I AM NOT DONE
#[test] #[test]
fn main() { fn main() {
let vec0 = vec![22, 44, 66]; let vec0 = vec![22, 44, 66];

View file

@ -6,8 +6,6 @@
// Execute `rustlings hint move_semantics3` or use the `hint` watch subcommand // Execute `rustlings hint move_semantics3` or use the `hint` watch subcommand
// for a hint. // for a hint.
// I AM NOT DONE
#[test] #[test]
fn main() { fn main() {
let vec0 = vec![22, 44, 66]; let vec0 = vec![22, 44, 66];

View file

@ -7,8 +7,6 @@
// Execute `rustlings hint move_semantics4` or use the `hint` watch subcommand // Execute `rustlings hint move_semantics4` or use the `hint` watch subcommand
// for a hint. // for a hint.
// I AM NOT DONE
#[test] #[test]
fn main() { fn main() {
let vec0 = vec![22, 44, 66]; let vec0 = vec![22, 44, 66];

View file

@ -6,8 +6,6 @@
// Execute `rustlings hint move_semantics5` or use the `hint` watch subcommand // Execute `rustlings hint move_semantics5` or use the `hint` watch subcommand
// for a hint. // for a hint.
// I AM NOT DONE
#[test] #[test]
fn main() { fn main() {
let mut x = 100; let mut x = 100;

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint move_semantics6` or use the `hint` watch subcommand // Execute `rustlings hint move_semantics6` or use the `hint` watch subcommand
// for a hint. // for a hint.
// I AM NOT DONE
fn main() { fn main() {
let data = "Rust is great!".to_string(); let data = "Rust is great!".to_string();

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint structs1` or use the `hint` watch subcommand for a // Execute `rustlings hint structs1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
struct ColorClassicStruct { struct ColorClassicStruct {
// TODO: Something goes here // TODO: Something goes here
} }

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint structs2` or use the `hint` watch subcommand for a // Execute `rustlings hint structs2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
#[derive(Debug)] #[derive(Debug)]
struct Order { struct Order {
name: String, name: String,

View file

@ -7,8 +7,6 @@
// Execute `rustlings hint structs3` or use the `hint` watch subcommand for a // Execute `rustlings hint structs3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
#[derive(Debug)] #[derive(Debug)]
struct Package { struct Package {
sender_country: String, sender_country: String,

View file

@ -2,8 +2,6 @@
// //
// No hints this time! ;) // No hints this time! ;)
// I AM NOT DONE
#[derive(Debug)] #[derive(Debug)]
enum Message { enum Message {
// TODO: define a few types of messages as used below // TODO: define a few types of messages as used below

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint enums2` or use the `hint` watch subcommand for a // Execute `rustlings hint enums2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
#[derive(Debug)] #[derive(Debug)]
enum Message { enum Message {
// TODO: define the different variants used below // TODO: define the different variants used below

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint enums3` or use the `hint` watch subcommand for a // Execute `rustlings hint enums3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
enum Message { enum Message {
// TODO: implement the message variant types based on their usage below // TODO: implement the message variant types based on their usage below
} }

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint strings1` or use the `hint` watch subcommand for a // Execute `rustlings hint strings1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
let answer = current_favorite_color(); let answer = current_favorite_color();
println!("My current favorite color is {}", answer); println!("My current favorite color is {}", answer);

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint strings2` or use the `hint` watch subcommand for a // Execute `rustlings hint strings2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
let word = String::from("green"); // Try not changing this line :) let word = String::from("green"); // Try not changing this line :)
if is_a_color_word(word) { if is_a_color_word(word) {

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint strings3` or use the `hint` watch subcommand for a // Execute `rustlings hint strings3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn trim_me(input: &str) -> String { fn trim_me(input: &str) -> String {
// TODO: Remove whitespace from both ends of a string! // TODO: Remove whitespace from both ends of a string!
??? ???

View file

@ -7,8 +7,6 @@
// //
// No hints this time! // No hints this time!
// I AM NOT DONE
fn string_slice(arg: &str) { fn string_slice(arg: &str) {
println!("{}", arg); println!("{}", arg);
} }

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint modules1` or use the `hint` watch subcommand for a // Execute `rustlings hint modules1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
mod sausage_factory { mod sausage_factory {
// Don't let anybody outside of this module see this! // Don't let anybody outside of this module see this!
fn get_secret_recipe() -> String { fn get_secret_recipe() -> String {

View file

@ -7,8 +7,6 @@
// Execute `rustlings hint modules2` or use the `hint` watch subcommand for a // Execute `rustlings hint modules2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
mod delicious_snacks { mod delicious_snacks {
// TODO: Fix these use statements // TODO: Fix these use statements
use self::fruits::PEAR as ??? use self::fruits::PEAR as ???

View file

@ -8,8 +8,6 @@
// Execute `rustlings hint modules3` or use the `hint` watch subcommand for a // Execute `rustlings hint modules3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
// TODO: Complete this use statement // TODO: Complete this use statement
use ??? use ???

View file

@ -11,8 +11,6 @@
// Execute `rustlings hint hashmaps1` or use the `hint` watch subcommand for a // Execute `rustlings hint hashmaps1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
use std::collections::HashMap; use std::collections::HashMap;
fn fruit_basket() -> HashMap<String, u32> { fn fruit_basket() -> HashMap<String, u32> {

View file

@ -14,8 +14,6 @@
// Execute `rustlings hint hashmaps2` or use the `hint` watch subcommand for a // Execute `rustlings hint hashmaps2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
use std::collections::HashMap; use std::collections::HashMap;
#[derive(Hash, PartialEq, Eq)] #[derive(Hash, PartialEq, Eq)]

View file

@ -15,8 +15,6 @@
// Execute `rustlings hint hashmaps3` or use the `hint` watch subcommand for a // Execute `rustlings hint hashmaps3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
use std::collections::HashMap; use std::collections::HashMap;
// A structure to store the goal details of a team. // A structure to store the goal details of a team.

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint options1` or use the `hint` watch subcommand for a // Execute `rustlings hint options1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
// This function returns how much icecream there is left in the fridge. // This function returns how much icecream there is left in the fridge.
// If it's before 10PM, there's 5 scoops left. At 10PM, someone eats it // If it's before 10PM, there's 5 scoops left. At 10PM, someone eats it
// all, so there'll be no more left :( // all, so there'll be no more left :(

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint options2` or use the `hint` watch subcommand for a // Execute `rustlings hint options2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#[test] #[test]

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint options3` or use the `hint` watch subcommand for a // Execute `rustlings hint options3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
struct Point { struct Point {
x: i32, x: i32,
y: i32, y: i32,

View file

@ -9,8 +9,6 @@
// Execute `rustlings hint errors1` or use the `hint` watch subcommand for a // Execute `rustlings hint errors1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
pub fn generate_nametag_text(name: String) -> Option<String> { pub fn generate_nametag_text(name: String) -> Option<String> {
if name.is_empty() { if name.is_empty() {
// Empty names aren't allowed. // Empty names aren't allowed.

View file

@ -19,8 +19,6 @@
// Execute `rustlings hint errors2` or use the `hint` watch subcommand for a // Execute `rustlings hint errors2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
use std::num::ParseIntError; use std::num::ParseIntError;
pub fn total_cost(item_quantity: &str) -> Result<i32, ParseIntError> { pub fn total_cost(item_quantity: &str) -> Result<i32, ParseIntError> {

View file

@ -7,8 +7,6 @@
// Execute `rustlings hint errors3` or use the `hint` watch subcommand for a // Execute `rustlings hint errors3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
use std::num::ParseIntError; use std::num::ParseIntError;
fn main() { fn main() {

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint errors4` or use the `hint` watch subcommand for a // Execute `rustlings hint errors4` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
#[derive(PartialEq, Debug)] #[derive(PartialEq, Debug)]
struct PositiveNonzeroInteger(u64); struct PositiveNonzeroInteger(u64);

View file

@ -22,8 +22,6 @@
// Execute `rustlings hint errors5` or use the `hint` watch subcommand for a // Execute `rustlings hint errors5` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
use std::error; use std::error;
use std::fmt; use std::fmt;
use std::num::ParseIntError; use std::num::ParseIntError;

View file

@ -9,8 +9,6 @@
// Execute `rustlings hint errors6` or use the `hint` watch subcommand for a // Execute `rustlings hint errors6` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
use std::num::ParseIntError; use std::num::ParseIntError;
// This is a custom error type that we will be using in `parse_pos_nonzero()`. // This is a custom error type that we will be using in `parse_pos_nonzero()`.

View file

@ -6,8 +6,6 @@
// Execute `rustlings hint generics1` or use the `hint` watch subcommand for a // Execute `rustlings hint generics1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
let mut shopping_list: Vec<?> = Vec::new(); let mut shopping_list: Vec<?> = Vec::new();
shopping_list.push("milk"); shopping_list.push("milk");

View file

@ -6,8 +6,6 @@
// Execute `rustlings hint generics2` or use the `hint` watch subcommand for a // Execute `rustlings hint generics2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
struct Wrapper { struct Wrapper {
value: u32, value: u32,
} }

View file

@ -7,8 +7,6 @@
// Execute `rustlings hint traits1` or use the `hint` watch subcommand for a // Execute `rustlings hint traits1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
trait AppendBar { trait AppendBar {
fn append_bar(self) -> Self; fn append_bar(self) -> Self;
} }

View file

@ -8,8 +8,6 @@
// //
// Execute `rustlings hint traits2` or use the `hint` watch subcommand for a hint. // Execute `rustlings hint traits2` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
trait AppendBar { trait AppendBar {
fn append_bar(self) -> Self; fn append_bar(self) -> Self;
} }

View file

@ -8,8 +8,6 @@
// Execute `rustlings hint traits3` or use the `hint` watch subcommand for a // Execute `rustlings hint traits3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
pub trait Licensed { pub trait Licensed {
fn licensing_info(&self) -> String; fn licensing_info(&self) -> String;
} }

View file

@ -7,8 +7,6 @@
// Execute `rustlings hint traits4` or use the `hint` watch subcommand for a // Execute `rustlings hint traits4` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
pub trait Licensed { pub trait Licensed {
fn licensing_info(&self) -> String { fn licensing_info(&self) -> String {
"some information".to_string() "some information".to_string()

View file

@ -7,8 +7,6 @@
// Execute `rustlings hint traits5` or use the `hint` watch subcommand for a // Execute `rustlings hint traits5` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
pub trait SomeTrait { pub trait SomeTrait {
fn some_function(&self) -> bool { fn some_function(&self) -> bool {
true true

View file

@ -8,8 +8,6 @@
// Execute `rustlings hint lifetimes1` or use the `hint` watch subcommand for a // Execute `rustlings hint lifetimes1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn longest(x: &str, y: &str) -> &str { fn longest(x: &str, y: &str) -> &str {
if x.len() > y.len() { if x.len() > y.len() {
x x

View file

@ -6,8 +6,6 @@
// Execute `rustlings hint lifetimes2` or use the `hint` watch subcommand for a // Execute `rustlings hint lifetimes2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str { fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
if x.len() > y.len() { if x.len() > y.len() {
x x

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint lifetimes3` or use the `hint` watch subcommand for a // Execute `rustlings hint lifetimes3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
struct Book { struct Book {
author: &str, author: &str,
title: &str, title: &str,

View file

@ -10,8 +10,6 @@
// Execute `rustlings hint tests1` or use the `hint` watch subcommand for a // Execute `rustlings hint tests1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#[test] #[test]

View file

@ -6,8 +6,6 @@
// Execute `rustlings hint tests2` or use the `hint` watch subcommand for a // Execute `rustlings hint tests2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#[test] #[test]

View file

@ -7,8 +7,6 @@
// Execute `rustlings hint tests3` or use the `hint` watch subcommand for a // Execute `rustlings hint tests3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
pub fn is_even(num: i32) -> bool { pub fn is_even(num: i32) -> bool {
num % 2 == 0 num % 2 == 0
} }

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint tests4` or use the `hint` watch subcommand for a // Execute `rustlings hint tests4` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
struct Rectangle { struct Rectangle {
width: i32, width: i32,
height: i32 height: i32

View file

@ -9,8 +9,6 @@
// Execute `rustlings hint iterators1` or use the `hint` watch subcommand for a // Execute `rustlings hint iterators1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
#[test] #[test]
fn main() { fn main() {
let my_fav_fruits = vec!["banana", "custard apple", "avocado", "peach", "raspberry"]; let my_fav_fruits = vec!["banana", "custard apple", "avocado", "peach", "raspberry"];

View file

@ -6,8 +6,6 @@
// Execute `rustlings hint iterators2` or use the `hint` watch subcommand for a // Execute `rustlings hint iterators2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
// Step 1. // Step 1.
// Complete the `capitalize_first` function. // Complete the `capitalize_first` function.
// "hello" -> "Hello" // "hello" -> "Hello"

View file

@ -9,8 +9,6 @@
// Execute `rustlings hint iterators3` or use the `hint` watch subcommand for a // Execute `rustlings hint iterators3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
pub enum DivisionError { pub enum DivisionError {
NotDivisible(NotDivisibleError), NotDivisible(NotDivisibleError),

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint iterators4` or use the `hint` watch subcommand for a // Execute `rustlings hint iterators4` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
pub fn factorial(num: u64) -> u64 { pub fn factorial(num: u64) -> u64 {
// Complete this function to return the factorial of num // Complete this function to return the factorial of num
// Do not use: // Do not use:

View file

@ -11,8 +11,6 @@
// Execute `rustlings hint iterators5` or use the `hint` watch subcommand for a // Execute `rustlings hint iterators5` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
use std::collections::HashMap; use std::collections::HashMap;
#[derive(Clone, Copy, PartialEq, Eq)] #[derive(Clone, Copy, PartialEq, Eq)]

View file

@ -21,8 +21,6 @@
// //
// Execute `rustlings hint arc1` or use the `hint` watch subcommand for a hint. // Execute `rustlings hint arc1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
#![forbid(unused_imports)] // Do not change this, (or the next) line. #![forbid(unused_imports)] // Do not change this, (or the next) line.
use std::sync::Arc; use std::sync::Arc;
use std::thread; use std::thread;

View file

@ -18,8 +18,6 @@
// //
// Execute `rustlings hint box1` or use the `hint` watch subcommand for a hint. // Execute `rustlings hint box1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
#[derive(PartialEq, Debug)] #[derive(PartialEq, Debug)]
pub enum List { pub enum List {
Cons(i32, List), Cons(i32, List),

View file

@ -12,8 +12,6 @@
// //
// Execute `rustlings hint cow1` or use the `hint` watch subcommand for a hint. // Execute `rustlings hint cow1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
use std::borrow::Cow; use std::borrow::Cow;
fn abs_all<'a, 'b>(input: &'a mut Cow<'b, [i32]>) -> &'a mut Cow<'b, [i32]> { fn abs_all<'a, 'b>(input: &'a mut Cow<'b, [i32]>) -> &'a mut Cow<'b, [i32]> {

View file

@ -10,8 +10,6 @@
// //
// Execute `rustlings hint rc1` or use the `hint` watch subcommand for a hint. // Execute `rustlings hint rc1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
use std::rc::Rc; use std::rc::Rc;
#[derive(Debug)] #[derive(Debug)]

View file

@ -8,8 +8,6 @@
// Execute `rustlings hint threads1` or use the `hint` watch subcommand for a // Execute `rustlings hint threads1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
use std::thread; use std::thread;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};

View file

@ -7,8 +7,6 @@
// Execute `rustlings hint threads2` or use the `hint` watch subcommand for a // Execute `rustlings hint threads2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
use std::sync::Arc; use std::sync::Arc;
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint threads3` or use the `hint` watch subcommand for a // Execute `rustlings hint threads3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
use std::sync::mpsc; use std::sync::mpsc;
use std::sync::Arc; use std::sync::Arc;
use std::thread; use std::thread;

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint macros1` or use the `hint` watch subcommand for a // Execute `rustlings hint macros1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
macro_rules! my_macro { macro_rules! my_macro {
() => { () => {
println!("Check out my macro!"); println!("Check out my macro!");

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint macros2` or use the `hint` watch subcommand for a // Execute `rustlings hint macros2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
my_macro!(); my_macro!();
} }

View file

@ -5,8 +5,6 @@
// Execute `rustlings hint macros3` or use the `hint` watch subcommand for a // Execute `rustlings hint macros3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
mod macros { mod macros {
macro_rules! my_macro { macro_rules! my_macro {
() => { () => {

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint macros4` or use the `hint` watch subcommand for a // Execute `rustlings hint macros4` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
#[rustfmt::skip] #[rustfmt::skip]
macro_rules! my_macro { macro_rules! my_macro {
() => { () => {

View file

@ -9,8 +9,6 @@
// Execute `rustlings hint clippy1` or use the `hint` watch subcommand for a // Execute `rustlings hint clippy1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
use std::f32; use std::f32;
fn main() { fn main() {

View file

@ -3,8 +3,6 @@
// Execute `rustlings hint clippy2` or use the `hint` watch subcommand for a // Execute `rustlings hint clippy2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
fn main() { fn main() {
let mut res = 42; let mut res = 42;
let option = Some(12); let option = Some(12);

View file

@ -3,8 +3,6 @@
// Here's a couple more easy Clippy fixes, so you can see its utility. // Here's a couple more easy Clippy fixes, so you can see its utility.
// No hints. // No hints.
// I AM NOT DONE
#[allow(unused_variables, unused_assignments)] #[allow(unused_variables, unused_assignments)]
fn main() { fn main() {
let my_option: Option<()> = None; let my_option: Option<()> = None;

View file

@ -7,8 +7,6 @@
// Execute `rustlings hint as_ref_mut` or use the `hint` watch subcommand for a // Execute `rustlings hint as_ref_mut` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
// Obtain the number of bytes (not characters) in the given argument. // Obtain the number of bytes (not characters) in the given argument.
// TODO: Add the AsRef trait appropriately as a trait bound. // TODO: Add the AsRef trait appropriately as a trait bound.
fn byte_counter<T>(arg: T) -> usize { fn byte_counter<T>(arg: T) -> usize {

View file

@ -41,8 +41,6 @@ impl Default for Person {
// If while parsing the age, something goes wrong, then return the default of // If while parsing the age, something goes wrong, then return the default of
// Person Otherwise, then return an instantiated Person object with the results // Person Otherwise, then return an instantiated Person object with the results
// I AM NOT DONE
impl From<&str> for Person { impl From<&str> for Person {
fn from(s: &str) -> Person {} fn from(s: &str) -> Person {}
} }

View file

@ -31,8 +31,6 @@ enum ParsePersonError {
ParseInt(ParseIntError), ParseInt(ParseIntError),
} }
// I AM NOT DONE
// Steps: // Steps:
// 1. If the length of the provided string is 0, an error should be returned // 1. If the length of the provided string is 0, an error should be returned
// 2. Split the given string on the commas present in it // 2. Split the given string on the commas present in it

Some files were not shown because too many files have changed in this diff Show more