From 13cdc1aa699f20bf7c20c67140ac90c6e99473e8 Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Sat, 20 Jun 2020 11:11:45 +0200 Subject: [PATCH 1/2] feat: add fake manifest for analyzers/IDEs (fixes #443) --- .cargo/config | 2 + .gitignore | 1 + Cargo.lock | 66 ++++---- Cargo.toml | 8 +- README.md | 11 ++ exercises/Cargo.toml | 286 +++++++++++++++++++++++++++++++++++ src/main.rs | 29 +++- tests/integration_tests.rs | 20 --- tests/project_consistency.rs | 30 ++++ tooling/Cargo.toml | 11 ++ tooling/src/lib.rs | 79 ++++++++++ 11 files changed, 491 insertions(+), 52 deletions(-) create mode 100644 .cargo/config create mode 100644 exercises/Cargo.toml create mode 100644 tests/project_consistency.rs create mode 100644 tooling/Cargo.toml create mode 100644 tooling/src/lib.rs diff --git a/.cargo/config b/.cargo/config new file mode 100644 index 0000000000..d57ee26a53 --- /dev/null +++ b/.cargo/config @@ -0,0 +1,2 @@ +[alias] +generate-manifest = "run --features maintainer -- maintainer" diff --git a/.gitignore b/.gitignore index 06de871045..af122cdf04 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ exercises/clippy/Cargo.toml exercises/clippy/Cargo.lock .idea .vscode +exercises/Cargo.lock diff --git a/Cargo.lock b/Cargo.lock index cdc1af352b..5bcb42665e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -134,7 +134,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -431,18 +431,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "0.4.30" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quote" -version = "0.6.12" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -602,8 +602,9 @@ dependencies = [ "notify 4.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "predicates 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tooling 0.1.0", ] [[package]] @@ -639,20 +640,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.92" +version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.92" +version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -662,7 +663,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -682,12 +683,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "0.15.34" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -727,10 +728,19 @@ dependencies = [ [[package]] name = "toml" -version = "0.4.10" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tooling" +version = "0.1.0" +dependencies = [ + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -750,7 +760,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-xid" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -869,8 +879,8 @@ dependencies = [ "checksum predicates 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "53e09015b0d3f5a0ec2d4428f7559bb7b3fff341b4e159fedd1d57fac8b939ff" "checksum predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06075c3a3e92559ff8929e7a280684489ea27fe44805174c3ebd9328dcb37178" "checksum predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e63c4859013b38a76eca2414c64911fba30def9e3202ac461a2d22831220124" -"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" +"checksum proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" +"checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" @@ -892,22 +902,22 @@ dependencies = [ "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)" = "32746bf0f26eab52f06af0d0aa1984f641341d06d8d673c693871da2d188c9be" -"checksum serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)" = "46a3223d0c9ba936b61c0d2e3e559e3217dbfb8d65d06d26e8b3c25de38bae3e" +"checksum serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)" = "736aac72d1eafe8e5962d1d1c3d99b0df526015ba40915cb3c49d042e92ec243" +"checksum serde_derive 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)" = "bf0343ce212ac0d3d6afd9391ac8e9c9efe06b533c8d33f660f6390cc4093f57" "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe" +"checksum syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6" "checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" "checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" +"checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" "checksum treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" diff --git a/Cargo.toml b/Cargo.toml index 681428456a..b4d86fb36e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,14 +4,19 @@ version = "4.1.0" authors = ["Marisa ", "Carol (Nichols || Goulding) "] edition = "2018" +[features] +# Internal tooling for maintainers +maintainer = ["tooling"] + [dependencies] clap = "2.32.0" indicatif = "0.10.3" console = "0.7.7" notify = "4.0.15" -toml = "0.4.10" +toml = "0.5.6" regex = "1.1.6" serde = {version = "1.0.10", features = ["derive"]} +tooling = { path = "./tooling", optional = true } [[bin]] name = "rustlings" @@ -21,3 +26,4 @@ path = "src/main.rs" assert_cmd = "0.11.0" predicates = "1.0.1" glob = "0.3.0" +tooling = { path = "./tooling" } diff --git a/README.md b/README.md index a618abb592..121007986f 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,17 @@ exercise: rustlings hint myExercise1 ``` +### Using an IDE +**TL,DR**: open the `exercises/` folder in your editor. + +There are several editors and plugins that are able to analyze Rust code for a full blown IDE (or IDE-like) experience. The official language plugin of the Rust project is [rust-analyzer](rust-analyzer), but there are others, like [IntelliJ Rust](intellij) or [rls](rls). + +These tools usually rely on the default structure of a Cargo project to perform their analyses. Conversely, Rustlings is conceived as a collection of isolated exercises. Nevertheless, we auto-generate a "fake" project manifest in `exercises/Cargo.toml` that should bypass this mismatch. If you open the `exercises/` folder with your Rust-enabled editor, you should be able to enjoy its capabilities. + +[rust-analyzer]: https://rust-analyzer.github.io/ +[rls]: https://github.com/rust-lang/rls +[intellij]: https://intellij-rust.github.io/ + ## Testing yourself 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`. diff --git a/exercises/Cargo.toml b/exercises/Cargo.toml new file mode 100644 index 0000000000..da3b7a8cf5 --- /dev/null +++ b/exercises/Cargo.toml @@ -0,0 +1,286 @@ +# This Cargo.toml is AUTOGENERATED, you shouldn't need to edit it. +# The `rustling` commands do not rely on this manifest at all, its only purpose +# is to help editors analyze your code. +# To regenerate it, run `cargo generate-manifest`. +[package] +name = 'exercises' +version = '0.1.0' +edition = '2018' +authors = ['The Rustlings Maintainers'] +publish = false + +[[bin]] +name = 'clippy1' +path = 'clippy/clippy1.rs' + +[[bin]] +name = 'clippy2' +path = 'clippy/clippy2.rs' + +[[bin]] +name = 'as_ref_mut' +path = 'conversions/as_ref_mut.rs' + +[[bin]] +name = 'from_into' +path = 'conversions/from_into.rs' + +[[bin]] +name = 'from_str' +path = 'conversions/from_str.rs' + +[[bin]] +name = 'try_from_into' +path = 'conversions/try_from_into.rs' + +[[bin]] +name = 'using_as' +path = 'conversions/using_as.rs' + +[[bin]] +name = 'enums1' +path = 'enums/enums1.rs' + +[[bin]] +name = 'enums2' +path = 'enums/enums2.rs' + +[[bin]] +name = 'enums3' +path = 'enums/enums3.rs' + +[[bin]] +name = 'errors1' +path = 'error_handling/errors1.rs' + +[[bin]] +name = 'errors2' +path = 'error_handling/errors2.rs' + +[[bin]] +name = 'errors3' +path = 'error_handling/errors3.rs' + +[[bin]] +name = 'errorsn' +path = 'error_handling/errorsn.rs' + +[[bin]] +name = 'result1' +path = 'error_handling/result1.rs' + +[[bin]] +name = 'functions1' +path = 'functions/functions1.rs' + +[[bin]] +name = 'functions2' +path = 'functions/functions2.rs' + +[[bin]] +name = 'functions3' +path = 'functions/functions3.rs' + +[[bin]] +name = 'functions4' +path = 'functions/functions4.rs' + +[[bin]] +name = 'functions5' +path = 'functions/functions5.rs' + +[[bin]] +name = 'generics1' +path = 'generics/generics1.rs' + +[[bin]] +name = 'generics2' +path = 'generics/generics2.rs' + +[[bin]] +name = 'generics3' +path = 'generics/generics3.rs' + +[[bin]] +name = 'if1' +path = 'if/if1.rs' + +[[bin]] +name = 'if2' +path = 'if/if2.rs' + +[[bin]] +name = 'macros1' +path = 'macros/macros1.rs' + +[[bin]] +name = 'macros2' +path = 'macros/macros2.rs' + +[[bin]] +name = 'macros3' +path = 'macros/macros3.rs' + +[[bin]] +name = 'macros4' +path = 'macros/macros4.rs' + +[[bin]] +name = 'modules1' +path = 'modules/modules1.rs' + +[[bin]] +name = 'modules2' +path = 'modules/modules2.rs' + +[[bin]] +name = 'move_semantics1' +path = 'move_semantics/move_semantics1.rs' + +[[bin]] +name = 'move_semantics2' +path = 'move_semantics/move_semantics2.rs' + +[[bin]] +name = 'move_semantics3' +path = 'move_semantics/move_semantics3.rs' + +[[bin]] +name = 'move_semantics4' +path = 'move_semantics/move_semantics4.rs' + +[[bin]] +name = 'option1' +path = 'option/option1.rs' + +[[bin]] +name = 'option2' +path = 'option/option2.rs' + +[[bin]] +name = 'primitive_types1' +path = 'primitive_types/primitive_types1.rs' + +[[bin]] +name = 'primitive_types2' +path = 'primitive_types/primitive_types2.rs' + +[[bin]] +name = 'primitive_types3' +path = 'primitive_types/primitive_types3.rs' + +[[bin]] +name = 'primitive_types4' +path = 'primitive_types/primitive_types4.rs' + +[[bin]] +name = 'primitive_types5' +path = 'primitive_types/primitive_types5.rs' + +[[bin]] +name = 'primitive_types6' +path = 'primitive_types/primitive_types6.rs' + +[[bin]] +name = 'quiz1' +path = 'quiz1.rs' + +[[bin]] +name = 'quiz2' +path = 'quiz2.rs' + +[[bin]] +name = 'quiz3' +path = 'quiz3.rs' + +[[bin]] +name = 'quiz4' +path = 'quiz4.rs' + +[[bin]] +name = 'arc1' +path = 'standard_library_types/arc1.rs' + +[[bin]] +name = 'box1' +path = 'standard_library_types/box1.rs' + +[[bin]] +name = 'iterators2' +path = 'standard_library_types/iterators2.rs' + +[[bin]] +name = 'iterators3' +path = 'standard_library_types/iterators3.rs' + +[[bin]] +name = 'iterators4' +path = 'standard_library_types/iterators4.rs' + +[[bin]] +name = 'strings1' +path = 'strings/strings1.rs' + +[[bin]] +name = 'strings2' +path = 'strings/strings2.rs' + +[[bin]] +name = 'structs1' +path = 'structs/structs1.rs' + +[[bin]] +name = 'structs2' +path = 'structs/structs2.rs' + +[[bin]] +name = 'structs3' +path = 'structs/structs3.rs' + +[[bin]] +name = 'tests1' +path = 'tests/tests1.rs' + +[[bin]] +name = 'tests2' +path = 'tests/tests2.rs' + +[[bin]] +name = 'tests3' +path = 'tests/tests3.rs' + +[[bin]] +name = 'threads1' +path = 'threads/threads1.rs' + +[[bin]] +name = 'traits1' +path = 'traits/traits1.rs' + +[[bin]] +name = 'traits2' +path = 'traits/traits2.rs' + +[[bin]] +name = 'variables1' +path = 'variables/variables1.rs' + +[[bin]] +name = 'variables2' +path = 'variables/variables2.rs' + +[[bin]] +name = 'variables3' +path = 'variables/variables3.rs' + +[[bin]] +name = 'variables4' +path = 'variables/variables4.rs' + +[[bin]] +name = 'variables5' +path = 'variables/variables5.rs' + +[[bin]] +name = 'variables6' +path = 'variables/variables6.rs' diff --git a/src/main.rs b/src/main.rs index b5814bfbca..3b9ee2ae30 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,7 +23,7 @@ mod run; mod verify; fn main() { - let matches = App::new("rustlings") + let app = App::new("rustlings") .version(crate_version!()) .author("Olivia Hugger, Carol Nichols") .about("Rustlings is a collection of small exercises to get you used to writing and reading Rust code") @@ -53,8 +53,18 @@ fn main() { .alias("h") .about("Returns a hint for the current exercise") .arg(Arg::with_name("name").required(true).index(1)), - ) - .get_matches(); + ); + + let matches; + #[cfg(feature = "maintainer")] + { + let app = app.subcommand(SubCommand::with_name("maintainer")); + matches = app.get_matches(); + } + #[cfg(not(feature = "maintainer"))] + { + matches = app.get_matches(); + } if matches.subcommand_name().is_none() { println!(); @@ -88,6 +98,13 @@ fn main() { let exercises = toml::from_str::(toml_str).unwrap().exercises; let verbose = matches.is_present("nocapture"); + #[cfg(feature = "maintainer")] + { + if matches.subcommand_matches("maintainer").is_some() { + maintainer(); + } + } + if let Some(ref matches) = matches.subcommand_matches("run") { let name = matches.value_of("name").unwrap(); @@ -217,3 +234,9 @@ fn rustc_exists() -> bool { .map(|status| status.success()) .unwrap_or(false) } + +#[cfg(feature = "maintainer")] +fn maintainer() { + let manifest = tooling::generate(&Path::new("exercises")); + fs::write("exercises/Cargo.toml", manifest).unwrap(); +} diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 2baf9b863d..f82d3f5ec0 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -1,8 +1,5 @@ use assert_cmd::prelude::*; -use glob::glob; use predicates::boolean::PredicateBooleanExt; -use std::fs::File; -use std::io::Read; use std::process::Command; #[test] @@ -121,23 +118,6 @@ fn get_hint_for_single_test() { .stdout("Hello!\n"); } -#[test] -fn all_exercises_require_confirmation() { - for exercise in glob("exercises/**/*.rs").unwrap() { - let path = exercise.unwrap(); - let source = { - let mut file = File::open(&path).unwrap(); - let mut s = String::new(); - file.read_to_string(&mut s).unwrap(); - s - }; - source.matches("// I AM NOT DONE").next().expect(&format!( - "There should be an `I AM NOT DONE` annotation in {:?}", - path - )); - } -} - #[test] fn run_compile_exercise_does_not_prompt() { Command::cargo_bin("rustlings") diff --git a/tests/project_consistency.rs b/tests/project_consistency.rs new file mode 100644 index 0000000000..dbb85b7eb2 --- /dev/null +++ b/tests/project_consistency.rs @@ -0,0 +1,30 @@ +use glob::glob; +use std::fs; +use std::path::{Path, PathBuf}; + +#[test] +fn all_exercises_require_confirmation() { + for path in all_exercises() { + let source = fs::read_to_string(&path).unwrap(); + source.matches("// I AM NOT DONE").next().expect(&format!( + "There should be an `I AM NOT DONE` annotation in {:?}", + path + )); + } +} + +#[test] +fn cargo_toml_is_up_to_date() { + let exercises_manifest = fs::read_to_string("exercises/Cargo.toml").unwrap(); + let generated_manifest = tooling::generate(&Path::new("exercises")); + assert_eq!( + generated_manifest, exercises_manifest, + "exercises/Cargo.toml is not up to date, run `cargo generate-manifest`" + ); +} + +fn all_exercises() -> impl Iterator { + glob("exercises/**/*.rs") + .unwrap() + .map(|result| result.expect("Unable to traverse exercises folder")) +} diff --git a/tooling/Cargo.toml b/tooling/Cargo.toml new file mode 100644 index 0000000000..fe3646de88 --- /dev/null +++ b/tooling/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "tooling" +version = "0.1.0" +authors = ["The Rustlings Maintainers"] +edition = "2018" +publish = false + +[dependencies] +glob = "0.3.0" +serde = { version = "1.0.112", feature = ["derive"] } +toml = "0.5.6" diff --git a/tooling/src/lib.rs b/tooling/src/lib.rs new file mode 100644 index 0000000000..d7e23a86fd --- /dev/null +++ b/tooling/src/lib.rs @@ -0,0 +1,79 @@ +use glob::glob; +use serde::Serialize; +use std::path::Path; +use toml; + +pub fn generate(root: &Path) -> String { + let mut bins = vec![]; + + let root_glob = { + let mut p = root.to_owned(); + p.push("**"); + p.push("*.rs"); + p + }; + + let mut exercise_paths: Vec<_> = glob(root_glob.to_str().unwrap()) + .unwrap() + .collect::>() + .expect("Error traversing root"); + + exercise_paths.sort(); + + for path in &exercise_paths { + let name = path + .file_stem() + .expect("Malformed exercise path") + .to_str() + .expect("Invalid UTF8 in exercise path") + .to_string(); + + let target_path = path.strip_prefix(root).unwrap(); + + bins.push(Bin { + name, + path: target_path.to_str().unwrap().to_string(), + }); + } + + let manifest = Manifest { + package: Package { + name: "exercises", + version: "0.1.0", + authors: &["The Rustlings Maintainers"], + edition: "2018", + publish: false, + }, + bin: bins, + }; + + format!( + "# This Cargo.toml is AUTOGENERATED, you shouldn't need to edit it.\n\ + # The `rustling` commands do not rely on this manifest at all, its only purpose\n\ + # is to help editors analyze your code.\n\ + # To regenerate it, run `cargo generate-manifest`.\n\ + {}", + toml::ser::to_string_pretty(&manifest).expect("Invalid toml") + ) +} + +#[derive(Serialize)] +struct Manifest { + package: Package, + bin: Vec, +} + +#[derive(Serialize)] +struct Package { + name: &'static str, + version: &'static str, + edition: &'static str, + authors: &'static [&'static str], + publish: bool, +} + +#[derive(Serialize)] +struct Bin { + name: String, + path: String, +} From 47b2dfc7fea4685253bd72a67975ab8adf459a4e Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Mon, 26 Oct 2020 21:22:25 +0100 Subject: [PATCH 2/2] Change approach to point to current exercise --- .cargo/config | 2 - .gitignore | 1 + Cargo.lock | 600 +++++++++++++++++------------------ Cargo.toml | 6 - README.md | 6 +- exercises/Cargo.toml | 286 ----------------- info.toml | 2 + src/exercise.rs | 31 +- src/main.rs | 46 +-- src/manifest.rs | 76 +++++ src/verify.rs | 7 +- tests/project_consistency.rs | 12 +- tooling/Cargo.toml | 11 - tooling/src/lib.rs | 79 ----- 14 files changed, 413 insertions(+), 752 deletions(-) delete mode 100644 .cargo/config delete mode 100644 exercises/Cargo.toml create mode 100644 src/manifest.rs delete mode 100644 tooling/Cargo.toml delete mode 100644 tooling/src/lib.rs diff --git a/.cargo/config b/.cargo/config deleted file mode 100644 index d57ee26a53..0000000000 --- a/.cargo/config +++ /dev/null @@ -1,2 +0,0 @@ -[alias] -generate-manifest = "run --features maintainer -- maintainer" diff --git a/.gitignore b/.gitignore index af122cdf04..a5657b0ffb 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ exercises/clippy/Cargo.lock .idea .vscode exercises/Cargo.lock +exercises/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index 5bcb42665e..9345e7f98e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,927 +4,915 @@ name = "aho-corasick" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" dependencies = [ - "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8", ] [[package]] name = "assert_cmd" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dc477793bd82ec39799b6f6b3df64938532fdf2ab0d49ef817eac65856a5a1e" dependencies = [ - "escargot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "predicates 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "escargot", + "predicates", + "predicates-core", + "predicates-tree", ] [[package]] name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "termion", + "winapi 0.3.8", ] [[package]] name = "autocfg" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf" [[package]] name = "bitflags" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" [[package]] name = "cfg-if" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" [[package]] name = "clap" version = "2.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", ] [[package]] name = "clicolors-control" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73abfd4c73d003a674ce5d2933fca6ce6c42480ea84a5ffe0a2dc39ed56300f9" dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "lazy_static", + "libc", + "winapi 0.3.8", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", ] [[package]] name = "console" version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca57c2c14b8a2bf3105bc9d15574aad80babf6a9c44b1058034cdf8bd169628" dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "atty", + "clicolors-control", + "encode_unicode", + "lazy_static", + "libc", + "parking_lot", + "regex", + "termios", + "unicode-width", + "winapi 0.3.8", ] [[package]] name = "console" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b147390a412132d75d10dd3b7b175a69cf5fd95032f7503c7091b8831ba10242" dependencies = [ - "clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "clicolors-control", + "encode_unicode", + "lazy_static", + "libc", + "regex", + "termios", + "unicode-width", + "winapi 0.3.8", ] [[package]] name = "difference" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" [[package]] name = "encode_unicode" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd" [[package]] name = "escargot" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ceb9adbf9874d5d028b5e4c5739d22b71988252b25c9c98fe7cf9738bee84597" dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", + "log", + "serde", + "serde_json", ] [[package]] name = "filetime" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f8c63033fcba1f51ef744505b3cad42510432b904c062afa67ad7ece008429d" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if", + "libc", + "redox_syscall", ] [[package]] name = "float-cmp" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134a8fa843d80a51a5b77d36d42bc2def9edcb0262c914861d08129fd1926600" dependencies = [ - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits", ] [[package]] name = "fsevent" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "fsevent-sys", ] [[package]] name = "fsevent-sys" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "fuchsia-zircon" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "fuchsia-zircon-sys", ] [[package]] name = "fuchsia-zircon-sys" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "indicatif" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd1e2ee08e6c255ce890f5a99d17000850e664e7acf119fb03b25b0575bfe" dependencies = [ - "console 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "console 0.8.0", + "lazy_static", + "number_prefix", + "parking_lot", + "regex", ] [[package]] name = "inotify" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24e40d6fd5d64e2082e0c796495c8ef5ad667a96d03e5aaa0becfd9d47bcbfb8" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "inotify-sys", + "libc", ] [[package]] name = "inotify-sys" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "iovec" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "winapi 0.2.8", ] [[package]] name = "itoa" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8", + "winapi-build", ] [[package]] name = "lazy_static" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" [[package]] name = "lazycell" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" [[package]] name = "libc" version = "0.2.58" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6281b86796ba5e4366000be6e9e18bf35580adf9e63fbe2294aadb587613a319" [[package]] name = "lock_api" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff" dependencies = [ - "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard", ] [[package]] name = "log" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if", ] [[package]] name = "memchr" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" [[package]] name = "mio" version = "0.6.19" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83f51996a3ed004ef184e16818edc51fadffe8e7ca68be67f9dee67d84d0ff23" dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow", + "net2", + "slab", + "winapi 0.2.8", ] [[package]] name = "mio-extras" version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" dependencies = [ - "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell", + "log", + "mio", + "slab", ] [[package]] name = "miow" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", ] [[package]] name = "net2" version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if", + "libc", + "winapi 0.3.8", ] [[package]] name = "normalize-line-endings" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e0a1a39eab95caf4f5556da9289b9e68f0aafac901b2ce80daaf020d3b733a8" [[package]] name = "notify" version = "4.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80ae4a7688d1fab81c5bf19c64fc8db920be8d519ce6336ed4e7efe024724dbd" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "fsevent 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "inotify 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", - "mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "filetime", + "fsevent", + "fsevent-sys", + "inotify", + "libc", + "mio", + "mio-extras", + "walkdir", + "winapi 0.3.8", ] [[package]] name = "num-traits" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "number_prefix" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee" dependencies = [ - "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits", ] [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "parking_lot" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7767817701cce701d5585b9c4db3cdd02086398322c1d7e8bf5094a96a2ce7" dependencies = [ - "lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api", + "parking_lot_core", + "rustc_version", ] [[package]] name = "parking_lot_core" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb88cb1cb3790baa6776844f968fea3be44956cf184fa1be5a03341f5491278c" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if", + "cloudabi", + "libc", + "rand", + "redox_syscall", + "rustc_version", + "smallvec", + "winapi 0.3.8", ] [[package]] name = "predicates" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53e09015b0d3f5a0ec2d4428f7559bb7b3fff341b4e159fedd1d57fac8b939ff" dependencies = [ - "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "float-cmp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "normalize-line-endings 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "difference", + "float-cmp", + "normalize-line-endings", + "predicates-core", + "regex", ] [[package]] name = "predicates-core" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06075c3a3e92559ff8929e7a280684489ea27fe44805174c3ebd9328dcb37178" [[package]] name = "predicates-tree" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e63c4859013b38a76eca2414c64911fba30def9e3202ac461a2d22831220124" dependencies = [ - "predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "predicates-core", + "treeline", ] [[package]] name = "proc-macro2" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid", ] [[package]] name = "quote" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "rand" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "libc", + "rand_chacha", + "rand_core 0.4.0", + "rand_hc", + "rand_isaac", + "rand_jitter", + "rand_os", + "rand_pcg", + "rand_xorshift", + "winapi 0.3.8", ] [[package]] name = "rand_chacha" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "rand_core 0.3.1", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0", ] [[package]] name = "rand_core" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" [[package]] name = "rand_hc" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1", ] [[package]] name = "rand_isaac" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1", ] [[package]] name = "rand_jitter" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "rand_core 0.4.0", + "winapi 0.3.8", ] [[package]] name = "rand_os" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.4.0", + "rdrand", + "winapi 0.3.8", ] [[package]] name = "rand_pcg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", + "rand_core 0.4.0", ] [[package]] name = "rand_xorshift" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1", ] [[package]] name = "rdrand" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1", ] [[package]] name = "redox_syscall" version = "0.1.54" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" [[package]] name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" dependencies = [ - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall", ] [[package]] name = "regex" version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f0a0bcab2fd7d1d7c54fa9eae6f43eddeb9ce2e7352f8518a814a4f65d60c58" dependencies = [ - "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", + "utf8-ranges", ] [[package]] name = "regex-syntax" version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" dependencies = [ - "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ucd-util", ] [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver", ] [[package]] name = "rustlings" version = "4.1.0" dependencies = [ - "assert_cmd 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "console 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "indicatif 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", - "notify 4.0.15 (registry+https://github.com/rust-lang/crates.io-index)", - "predicates 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tooling 0.1.0", + "assert_cmd", + "clap", + "console 0.7.7", + "glob", + "indicatif", + "notify", + "predicates", + "regex", + "serde", + "toml", ] [[package]] name = "ryu" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f" [[package]] name = "same-file" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" dependencies = [ - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util", ] [[package]] name = "scopeguard" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver-parser", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736aac72d1eafe8e5962d1d1c3d99b0df526015ba40915cb3c49d042e92ec243" dependencies = [ - "serde_derive 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf0343ce212ac0d3d6afd9391ac8e9c9efe06b533c8d33f660f6390cc4093f57" dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "serde_json" version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" dependencies = [ - "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa", + "ryu", + "serde", ] [[package]] name = "slab" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "smallvec" version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6" dependencies = [ - "proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-xid", ] [[package]] name = "termion" version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "numtoa", + "redox_syscall", + "redox_termios", ] [[package]] name = "termios" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width", ] [[package]] name = "thread_local" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static", ] [[package]] name = "toml" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" dependencies = [ - "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tooling" -version = "0.1.0" -dependencies = [ - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", ] [[package]] name = "treeline" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" [[package]] name = "ucd-util" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" [[package]] name = "unicode-width" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" [[package]] name = "unicode-xid" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" [[package]] name = "utf8-ranges" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" [[package]] name = "vec_map" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" [[package]] name = "walkdir" version = "2.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" dependencies = [ - "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file", + "winapi 0.3.8", + "winapi-util", ] [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" dependencies = [ - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "ws2_32-sys" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum assert_cmd 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2dc477793bd82ec39799b6f6b3df64938532fdf2ab0d49ef817eac65856a5a1e" -"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf" -"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" -"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" -"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" -"checksum clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "73abfd4c73d003a674ce5d2933fca6ce6c42480ea84a5ffe0a2dc39ed56300f9" -"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum console 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8ca57c2c14b8a2bf3105bc9d15574aad80babf6a9c44b1058034cdf8bd169628" -"checksum console 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b147390a412132d75d10dd3b7b175a69cf5fd95032f7503c7091b8831ba10242" -"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" -"checksum encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd" -"checksum escargot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ceb9adbf9874d5d028b5e4c5739d22b71988252b25c9c98fe7cf9738bee84597" -"checksum filetime 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2f8c63033fcba1f51ef744505b3cad42510432b904c062afa67ad7ece008429d" -"checksum float-cmp 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "134a8fa843d80a51a5b77d36d42bc2def9edcb0262c914861d08129fd1926600" -"checksum fsevent 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" -"checksum fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum indicatif 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)" = "40ecd1e2ee08e6c255ce890f5a99d17000850e664e7acf119fb03b25b0575bfe" -"checksum inotify 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "24e40d6fd5d64e2082e0c796495c8ef5ad667a96d03e5aaa0becfd9d47bcbfb8" -"checksum inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0" -"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" -"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" -"checksum libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "6281b86796ba5e4366000be6e9e18bf35580adf9e63fbe2294aadb587613a319" -"checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff" -"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" -"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" -"checksum mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)" = "83f51996a3ed004ef184e16818edc51fadffe8e7ca68be67f9dee67d84d0ff23" -"checksum mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "46e73a04c2fa6250b8d802134d56d554a9ec2922bf977777c805ea5def61ce40" -"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" -"checksum normalize-line-endings 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2e0a1a39eab95caf4f5556da9289b9e68f0aafac901b2ce80daaf020d3b733a8" -"checksum notify 4.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "80ae4a7688d1fab81c5bf19c64fc8db920be8d519ce6336ed4e7efe024724dbd" -"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" -"checksum number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee" -"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" -"checksum parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa7767817701cce701d5585b9c4db3cdd02086398322c1d7e8bf5094a96a2ce7" -"checksum parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cb88cb1cb3790baa6776844f968fea3be44956cf184fa1be5a03341f5491278c" -"checksum predicates 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "53e09015b0d3f5a0ec2d4428f7559bb7b3fff341b4e159fedd1d57fac8b939ff" -"checksum predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06075c3a3e92559ff8929e7a280684489ea27fe44805174c3ebd9328dcb37178" -"checksum predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e63c4859013b38a76eca2414c64911fba30def9e3202ac461a2d22831220124" -"checksum proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" -"checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" -"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8f0a0bcab2fd7d1d7c54fa9eae6f43eddeb9ce2e7352f8518a814a4f65d60c58" -"checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f" -"checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" -"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)" = "736aac72d1eafe8e5962d1d1c3d99b0df526015ba40915cb3c49d042e92ec243" -"checksum serde_derive 1.0.112 (registry+https://github.com/rust-lang/crates.io-index)" = "bf0343ce212ac0d3d6afd9391ac8e9c9efe06b533c8d33f660f6390cc4093f57" -"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" -"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" -"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" -"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6" -"checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" -"checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625" -"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" -"checksum treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" -"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" -"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" -"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" + "winapi 0.2.8", + "winapi-build", +] diff --git a/Cargo.toml b/Cargo.toml index b4d86fb36e..149f40ceda 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,10 +4,6 @@ version = "4.1.0" authors = ["Marisa ", "Carol (Nichols || Goulding) "] edition = "2018" -[features] -# Internal tooling for maintainers -maintainer = ["tooling"] - [dependencies] clap = "2.32.0" indicatif = "0.10.3" @@ -16,7 +12,6 @@ notify = "4.0.15" toml = "0.5.6" regex = "1.1.6" serde = {version = "1.0.10", features = ["derive"]} -tooling = { path = "./tooling", optional = true } [[bin]] name = "rustlings" @@ -26,4 +21,3 @@ path = "src/main.rs" assert_cmd = "0.11.0" predicates = "1.0.1" glob = "0.3.0" -tooling = { path = "./tooling" } diff --git a/README.md b/README.md index 121007986f..9922907874 100644 --- a/README.md +++ b/README.md @@ -104,11 +104,13 @@ rustlings hint myExercise1 ``` ### Using an IDE -**TL,DR**: open the `exercises/` folder in your editor. +**TL,DR**: open the `exercises/` folder in your editor while running `rustlings watch`. There are several editors and plugins that are able to analyze Rust code for a full blown IDE (or IDE-like) experience. The official language plugin of the Rust project is [rust-analyzer](rust-analyzer), but there are others, like [IntelliJ Rust](intellij) or [rls](rls). -These tools usually rely on the default structure of a Cargo project to perform their analyses. Conversely, Rustlings is conceived as a collection of isolated exercises. Nevertheless, we auto-generate a "fake" project manifest in `exercises/Cargo.toml` that should bypass this mismatch. If you open the `exercises/` folder with your Rust-enabled editor, you should be able to enjoy its capabilities. +These tools usually rely on the default structure of a Cargo project to perform their analyses. Conversely, Rustlings has a _atypical_ structure: it's a collection of isolated exercises. Your editor might not be able to properly analyze the code of the exercises. + +However, if you run `rustlings watch`, we auto-generate a "fake" project manifest in `exercises/Cargo.toml` that points to the currently active exercise. If you open the `exercises/` folder with your Rust-enabled editor, you should be able to enjoy its capabilities. Note that we update the manifest so it always points to the current exercise, so ideally your editor should be able to refresh the project metadata automatically. [rust-analyzer]: https://rust-analyzer.github.io/ [rls]: https://github.com/rust-lang/rls diff --git a/exercises/Cargo.toml b/exercises/Cargo.toml deleted file mode 100644 index da3b7a8cf5..0000000000 --- a/exercises/Cargo.toml +++ /dev/null @@ -1,286 +0,0 @@ -# This Cargo.toml is AUTOGENERATED, you shouldn't need to edit it. -# The `rustling` commands do not rely on this manifest at all, its only purpose -# is to help editors analyze your code. -# To regenerate it, run `cargo generate-manifest`. -[package] -name = 'exercises' -version = '0.1.0' -edition = '2018' -authors = ['The Rustlings Maintainers'] -publish = false - -[[bin]] -name = 'clippy1' -path = 'clippy/clippy1.rs' - -[[bin]] -name = 'clippy2' -path = 'clippy/clippy2.rs' - -[[bin]] -name = 'as_ref_mut' -path = 'conversions/as_ref_mut.rs' - -[[bin]] -name = 'from_into' -path = 'conversions/from_into.rs' - -[[bin]] -name = 'from_str' -path = 'conversions/from_str.rs' - -[[bin]] -name = 'try_from_into' -path = 'conversions/try_from_into.rs' - -[[bin]] -name = 'using_as' -path = 'conversions/using_as.rs' - -[[bin]] -name = 'enums1' -path = 'enums/enums1.rs' - -[[bin]] -name = 'enums2' -path = 'enums/enums2.rs' - -[[bin]] -name = 'enums3' -path = 'enums/enums3.rs' - -[[bin]] -name = 'errors1' -path = 'error_handling/errors1.rs' - -[[bin]] -name = 'errors2' -path = 'error_handling/errors2.rs' - -[[bin]] -name = 'errors3' -path = 'error_handling/errors3.rs' - -[[bin]] -name = 'errorsn' -path = 'error_handling/errorsn.rs' - -[[bin]] -name = 'result1' -path = 'error_handling/result1.rs' - -[[bin]] -name = 'functions1' -path = 'functions/functions1.rs' - -[[bin]] -name = 'functions2' -path = 'functions/functions2.rs' - -[[bin]] -name = 'functions3' -path = 'functions/functions3.rs' - -[[bin]] -name = 'functions4' -path = 'functions/functions4.rs' - -[[bin]] -name = 'functions5' -path = 'functions/functions5.rs' - -[[bin]] -name = 'generics1' -path = 'generics/generics1.rs' - -[[bin]] -name = 'generics2' -path = 'generics/generics2.rs' - -[[bin]] -name = 'generics3' -path = 'generics/generics3.rs' - -[[bin]] -name = 'if1' -path = 'if/if1.rs' - -[[bin]] -name = 'if2' -path = 'if/if2.rs' - -[[bin]] -name = 'macros1' -path = 'macros/macros1.rs' - -[[bin]] -name = 'macros2' -path = 'macros/macros2.rs' - -[[bin]] -name = 'macros3' -path = 'macros/macros3.rs' - -[[bin]] -name = 'macros4' -path = 'macros/macros4.rs' - -[[bin]] -name = 'modules1' -path = 'modules/modules1.rs' - -[[bin]] -name = 'modules2' -path = 'modules/modules2.rs' - -[[bin]] -name = 'move_semantics1' -path = 'move_semantics/move_semantics1.rs' - -[[bin]] -name = 'move_semantics2' -path = 'move_semantics/move_semantics2.rs' - -[[bin]] -name = 'move_semantics3' -path = 'move_semantics/move_semantics3.rs' - -[[bin]] -name = 'move_semantics4' -path = 'move_semantics/move_semantics4.rs' - -[[bin]] -name = 'option1' -path = 'option/option1.rs' - -[[bin]] -name = 'option2' -path = 'option/option2.rs' - -[[bin]] -name = 'primitive_types1' -path = 'primitive_types/primitive_types1.rs' - -[[bin]] -name = 'primitive_types2' -path = 'primitive_types/primitive_types2.rs' - -[[bin]] -name = 'primitive_types3' -path = 'primitive_types/primitive_types3.rs' - -[[bin]] -name = 'primitive_types4' -path = 'primitive_types/primitive_types4.rs' - -[[bin]] -name = 'primitive_types5' -path = 'primitive_types/primitive_types5.rs' - -[[bin]] -name = 'primitive_types6' -path = 'primitive_types/primitive_types6.rs' - -[[bin]] -name = 'quiz1' -path = 'quiz1.rs' - -[[bin]] -name = 'quiz2' -path = 'quiz2.rs' - -[[bin]] -name = 'quiz3' -path = 'quiz3.rs' - -[[bin]] -name = 'quiz4' -path = 'quiz4.rs' - -[[bin]] -name = 'arc1' -path = 'standard_library_types/arc1.rs' - -[[bin]] -name = 'box1' -path = 'standard_library_types/box1.rs' - -[[bin]] -name = 'iterators2' -path = 'standard_library_types/iterators2.rs' - -[[bin]] -name = 'iterators3' -path = 'standard_library_types/iterators3.rs' - -[[bin]] -name = 'iterators4' -path = 'standard_library_types/iterators4.rs' - -[[bin]] -name = 'strings1' -path = 'strings/strings1.rs' - -[[bin]] -name = 'strings2' -path = 'strings/strings2.rs' - -[[bin]] -name = 'structs1' -path = 'structs/structs1.rs' - -[[bin]] -name = 'structs2' -path = 'structs/structs2.rs' - -[[bin]] -name = 'structs3' -path = 'structs/structs3.rs' - -[[bin]] -name = 'tests1' -path = 'tests/tests1.rs' - -[[bin]] -name = 'tests2' -path = 'tests/tests2.rs' - -[[bin]] -name = 'tests3' -path = 'tests/tests3.rs' - -[[bin]] -name = 'threads1' -path = 'threads/threads1.rs' - -[[bin]] -name = 'traits1' -path = 'traits/traits1.rs' - -[[bin]] -name = 'traits2' -path = 'traits/traits2.rs' - -[[bin]] -name = 'variables1' -path = 'variables/variables1.rs' - -[[bin]] -name = 'variables2' -path = 'variables/variables2.rs' - -[[bin]] -name = 'variables3' -path = 'variables/variables3.rs' - -[[bin]] -name = 'variables4' -path = 'variables/variables4.rs' - -[[bin]] -name = 'variables5' -path = 'variables/variables5.rs' - -[[bin]] -name = 'variables6' -path = 'variables/variables6.rs' diff --git a/info.toml b/info.toml index 2d0abdb15a..76df42d161 100644 --- a/info.toml +++ b/info.toml @@ -1,3 +1,5 @@ +root = "exercises" + # VARIABLES [[exercises]] diff --git a/src/exercise.rs b/src/exercise.rs index b07d7a119c..ca6d495ff8 100644 --- a/src/exercise.rs +++ b/src/exercise.rs @@ -1,13 +1,13 @@ use regex::Regex; use serde::Deserialize; use std::fmt::{self, Display, Formatter}; -use std::fs::{self, remove_file, File}; -use std::io::Read; +use std::fs::{self, remove_file}; use std::path::PathBuf; use std::process::{self, Command}; const RUSTC_COLOR_ARGS: &[&str] = &["--color", "always"]; const I_AM_DONE_REGEX: &str = r"(?m)^\s*///?\s*I\s+AM\s+NOT\s+DONE"; +const MAIN_FN_REGEX: &str = r"(?m)^\s*fn\s+main\s*\(\s*\)"; const CONTEXT: usize = 2; const CLIPPY_CARGO_TOML_PATH: &str = "./exercises/clippy/Cargo.toml"; @@ -30,7 +30,8 @@ pub enum Mode { } #[derive(Deserialize)] -pub struct ExerciseList { +pub struct ExerciseInfo { + pub root: Option, pub exercises: Vec, } @@ -187,17 +188,7 @@ path = "{}.rs""#, } pub fn state(&self) -> State { - let mut source_file = - File::open(&self.path).expect("We were unable to open the exercise file!"); - - let source = { - let mut s = String::new(); - source_file - .read_to_string(&mut s) - .expect("We were unable to read the exercise file!"); - s - }; - + let source = self.source(); let re = Regex::new(I_AM_DONE_REGEX).unwrap(); if !re.is_match(&source) { @@ -227,6 +218,16 @@ path = "{}.rs""#, State::Pending(context) } + + pub fn is_binary(&self) -> bool { + let source = self.source(); + let re = Regex::new(MAIN_FN_REGEX).unwrap(); + re.is_match(&source) + } + + fn source(&self) -> String { + fs::read_to_string(&self.path).expect("Unable to read exercise source") + } } impl Display for Exercise { @@ -243,7 +244,7 @@ fn clean() { #[cfg(test)] mod test { use super::*; - use std::path::Path; + use std::{fs::File, path::Path}; #[test] fn test_clean() { diff --git a/src/main.rs b/src/main.rs index 3b9ee2ae30..652ead2640 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use crate::exercise::{Exercise, ExerciseList}; +use crate::exercise::{Exercise, ExerciseInfo}; use crate::run::run; use crate::verify::verify; use clap::{crate_version, App, Arg, SubCommand}; @@ -19,11 +19,12 @@ use std::time::Duration; mod ui; mod exercise; +mod manifest; mod run; mod verify; fn main() { - let app = App::new("rustlings") + let matches = App::new("rustlings") .version(crate_version!()) .author("Olivia Hugger, Carol Nichols") .about("Rustlings is a collection of small exercises to get you used to writing and reading Rust code") @@ -53,18 +54,8 @@ fn main() { .alias("h") .about("Returns a hint for the current exercise") .arg(Arg::with_name("name").required(true).index(1)), - ); - - let matches; - #[cfg(feature = "maintainer")] - { - let app = app.subcommand(SubCommand::with_name("maintainer")); - matches = app.get_matches(); - } - #[cfg(not(feature = "maintainer"))] - { - matches = app.get_matches(); - } + ) + .get_matches(); if matches.subcommand_name().is_none() { println!(); @@ -95,16 +86,9 @@ fn main() { } let toml_str = &fs::read_to_string("info.toml").unwrap(); - let exercises = toml::from_str::(toml_str).unwrap().exercises; + let ExerciseInfo { exercises, root } = toml::from_str::(toml_str).unwrap(); let verbose = matches.is_present("nocapture"); - #[cfg(feature = "maintainer")] - { - if matches.subcommand_matches("maintainer").is_some() { - maintainer(); - } - } - if let Some(ref matches) = matches.subcommand_matches("run") { let name = matches.value_of("name").unwrap(); @@ -133,10 +117,12 @@ fn main() { } if matches.subcommand_matches("verify").is_some() { - verify(&exercises, verbose).unwrap_or_else(|_| std::process::exit(1)); + verify(&exercises, root.as_deref(), verbose).unwrap_or_else(|_| std::process::exit(1)); } - if matches.subcommand_matches("watch").is_some() && watch(&exercises, verbose).is_ok() { + if matches.subcommand_matches("watch").is_some() + && watch(&exercises, root.as_deref(), verbose).is_ok() + { println!( "{emoji} All exercises completed! {emoji}", emoji = Emoji("🎉", "★") @@ -179,7 +165,7 @@ fn spawn_watch_shell(failed_exercise_hint: &Arc>>) { }); } -fn watch(exercises: &[Exercise], verbose: bool) -> notify::Result<()> { +fn watch(exercises: &[Exercise], root: Option<&str>, verbose: bool) -> notify::Result<()> { /* Clears the terminal with an ANSI escape code. Works in UNIX and newer Windows terminals. */ fn clear_screen() { @@ -194,7 +180,7 @@ fn watch(exercises: &[Exercise], verbose: bool) -> notify::Result<()> { clear_screen(); let to_owned_hint = |t: &Exercise| t.hint.to_owned(); - let failed_exercise_hint = match verify(exercises.iter(), verbose) { + let failed_exercise_hint = match verify(exercises.iter(), root, verbose) { Ok(_) => return Ok(()), Err(exercise) => Arc::new(Mutex::new(Some(to_owned_hint(exercise)))), }; @@ -209,7 +195,7 @@ fn watch(exercises: &[Exercise], verbose: bool) -> notify::Result<()> { .iter() .skip_while(|e| !filepath.ends_with(&e.path)); clear_screen(); - match verify(pending_exercises, verbose) { + match verify(pending_exercises, root, verbose) { Ok(_) => return Ok(()), Err(exercise) => { let mut failed_exercise_hint = failed_exercise_hint.lock().unwrap(); @@ -234,9 +220,3 @@ fn rustc_exists() -> bool { .map(|status| status.success()) .unwrap_or(false) } - -#[cfg(feature = "maintainer")] -fn maintainer() { - let manifest = tooling::generate(&Path::new("exercises")); - fs::write("exercises/Cargo.toml", manifest).unwrap(); -} diff --git a/src/manifest.rs b/src/manifest.rs new file mode 100644 index 0000000000..a7f162bc24 --- /dev/null +++ b/src/manifest.rs @@ -0,0 +1,76 @@ +use std::fs; + +use serde::Serialize; +use toml; + +use crate::exercise::Exercise; + +pub fn update(exercise: &Exercise, root: Option<&str>) { + let root = if let Some(root) = root { + root + } else { + return; + }; + + let path = exercise + .path + .strip_prefix(root) + .expect("Invalid path outside of root") + .to_string_lossy() + .to_string(); + + let target = Target { + name: exercise.name.clone(), + path, + }; + + let (bins, lib) = if exercise.is_binary() { + (Some(vec![target]), None) + } else { + (None, Some(target)) + }; + + let manifest = Manifest { + package: Package { + name: "exercises", + version: "0.1.0", + authors: &["The Rustlings Maintainers"], + edition: "2018", + publish: false, + }, + bin: bins, + lib, + }; + + let source = format!( + "# This Cargo.toml is AUTOGENERATED, you shouldn't need to edit it.\n\ + # The `rustling` commands do not rely on this manifest at all, its only purpose\n\ + # is to help editors analyze your code.\n\ + {}", + toml::ser::to_string_pretty(&manifest).expect("Invalid toml") + ); + + fs::write(format!("{}/Cargo.toml", root), source).expect("Unable to update manifest") +} + +#[derive(Serialize)] +struct Manifest { + package: Package, + bin: Option>, + lib: Option, +} + +#[derive(Serialize)] +struct Package { + name: &'static str, + version: &'static str, + edition: &'static str, + authors: &'static [&'static str], + publish: bool, +} + +#[derive(Serialize)] +struct Target { + name: String, + path: String, +} diff --git a/src/verify.rs b/src/verify.rs index 00e45c8c26..23081cee6d 100644 --- a/src/verify.rs +++ b/src/verify.rs @@ -1,4 +1,7 @@ -use crate::exercise::{CompiledExercise, Exercise, Mode, State}; +use crate::{ + exercise::{CompiledExercise, Exercise, Mode, State}, + manifest, +}; use console::style; use indicatif::ProgressBar; @@ -9,6 +12,7 @@ use indicatif::ProgressBar; // determines whether or not the test harness outputs are displayed. pub fn verify<'a>( start_at: impl IntoIterator, + root: Option<&str>, verbose: bool, ) -> Result<(), &'a Exercise> { for exercise in start_at { @@ -18,6 +22,7 @@ pub fn verify<'a>( Mode::Clippy => compile_only(&exercise), }; if !compile_result.unwrap_or(false) { + manifest::update(exercise, root); return Err(exercise); } } diff --git a/tests/project_consistency.rs b/tests/project_consistency.rs index dbb85b7eb2..1c8beed7b8 100644 --- a/tests/project_consistency.rs +++ b/tests/project_consistency.rs @@ -1,6 +1,6 @@ use glob::glob; use std::fs; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; #[test] fn all_exercises_require_confirmation() { @@ -13,16 +13,6 @@ fn all_exercises_require_confirmation() { } } -#[test] -fn cargo_toml_is_up_to_date() { - let exercises_manifest = fs::read_to_string("exercises/Cargo.toml").unwrap(); - let generated_manifest = tooling::generate(&Path::new("exercises")); - assert_eq!( - generated_manifest, exercises_manifest, - "exercises/Cargo.toml is not up to date, run `cargo generate-manifest`" - ); -} - fn all_exercises() -> impl Iterator { glob("exercises/**/*.rs") .unwrap() diff --git a/tooling/Cargo.toml b/tooling/Cargo.toml deleted file mode 100644 index fe3646de88..0000000000 --- a/tooling/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "tooling" -version = "0.1.0" -authors = ["The Rustlings Maintainers"] -edition = "2018" -publish = false - -[dependencies] -glob = "0.3.0" -serde = { version = "1.0.112", feature = ["derive"] } -toml = "0.5.6" diff --git a/tooling/src/lib.rs b/tooling/src/lib.rs deleted file mode 100644 index d7e23a86fd..0000000000 --- a/tooling/src/lib.rs +++ /dev/null @@ -1,79 +0,0 @@ -use glob::glob; -use serde::Serialize; -use std::path::Path; -use toml; - -pub fn generate(root: &Path) -> String { - let mut bins = vec![]; - - let root_glob = { - let mut p = root.to_owned(); - p.push("**"); - p.push("*.rs"); - p - }; - - let mut exercise_paths: Vec<_> = glob(root_glob.to_str().unwrap()) - .unwrap() - .collect::>() - .expect("Error traversing root"); - - exercise_paths.sort(); - - for path in &exercise_paths { - let name = path - .file_stem() - .expect("Malformed exercise path") - .to_str() - .expect("Invalid UTF8 in exercise path") - .to_string(); - - let target_path = path.strip_prefix(root).unwrap(); - - bins.push(Bin { - name, - path: target_path.to_str().unwrap().to_string(), - }); - } - - let manifest = Manifest { - package: Package { - name: "exercises", - version: "0.1.0", - authors: &["The Rustlings Maintainers"], - edition: "2018", - publish: false, - }, - bin: bins, - }; - - format!( - "# This Cargo.toml is AUTOGENERATED, you shouldn't need to edit it.\n\ - # The `rustling` commands do not rely on this manifest at all, its only purpose\n\ - # is to help editors analyze your code.\n\ - # To regenerate it, run `cargo generate-manifest`.\n\ - {}", - toml::ser::to_string_pretty(&manifest).expect("Invalid toml") - ) -} - -#[derive(Serialize)] -struct Manifest { - package: Package, - bin: Vec, -} - -#[derive(Serialize)] -struct Package { - name: &'static str, - version: &'static str, - edition: &'static str, - authors: &'static [&'static str], - publish: bool, -} - -#[derive(Serialize)] -struct Bin { - name: String, - path: String, -}