1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-12-26 00:11:49 +02:00

Compare commits

...

11 Commits
4.7.0 ... 4.7.1

Author SHA1 Message Date
mokou
9ec35d899c chore: bump version
Plus, remove the clog configuration file,
since that's not being used anymore.
2022-04-20 09:44:37 +02:00
mokou
c811643d1e chore: bump library versions 2022-04-20 09:35:08 +02:00
mokou
a259704570 Merge remote-tracking branch 'origin/main' 2022-04-20 09:21:01 +02:00
mokou
268822dbd8 chore: bump minimum required rust version in installs 2022-04-20 09:20:42 +02:00
diannasoreil
1237aa574c Merge pull request #969 from Fointard/fointard_using_as
refactor(using_as): improve readability by using sum() instead of fold()
2022-04-20 09:15:22 +02:00
diannasoreil
b3734ba310 Merge pull request #972 from rust-lang/all-contributors/add-Fointard
docs: add Fointard as a contributor for content
2022-04-20 09:14:35 +02:00
allcontributors[bot]
c9b73e412e docs: update .all-contributorsrc [skip ci] 2022-04-20 07:14:27 +00:00
allcontributors[bot]
107f1f97d9 docs: update AUTHORS.md [skip ci] 2022-04-20 07:14:26 +00:00
diannasoreil
420729da60 Merge pull request #968 from Fointard/fointard_arc1
refactor(arc1): improve readability by using functional style
2022-04-20 09:14:08 +02:00
fointard
452ab26aa7 refactor(using_as): improve readability by using sum() instead of fold() 2022-04-19 17:37:00 +02:00
fointard
92a5d0037f refactor(arc1): improve readability by using functional style 2022-04-19 17:11:27 +02:00
13 changed files with 65 additions and 155 deletions

View File

@@ -1146,6 +1146,15 @@
"contributions": [
"content"
]
},
{
"login": "Fointard",
"name": "Fointard",
"avatar_url": "https://avatars.githubusercontent.com/u/9333398?v=4",
"profile": "https://github.com/Fointard",
"contributions": [
"content"
]
}
],
"contributorsPerLine": 8,

View File

@@ -1,4 +0,0 @@
[clog]
repository = "https://github.com/rust-lang/rustlings"
changelog = "CHANGELOG.md"

View File

@@ -164,6 +164,7 @@ authors.
<td align="center"><a href="https://github.com/ragreenburg"><img src="https://avatars.githubusercontent.com/u/24358100?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ragreenburg</b></sub></a><br /><a href="#content-ragreenburg" title="Content">🖋</a></td>
<td align="center"><a href="https://github.com/stevenfukase"><img src="https://avatars.githubusercontent.com/u/66785624?v=4?s=100" width="100px;" alt=""/><br /><sub><b>stevenfukase</b></sub></a><br /><a href="#content-stevenfukase" title="Content">🖋</a></td>
<td align="center"><a href="https://github.com/J-S-Kim"><img src="https://avatars.githubusercontent.com/u/17569303?v=4?s=100" width="100px;" alt=""/><br /><sub><b>J-S-Kim</b></sub></a><br /><a href="#content-J-S-Kim" title="Content">🖋</a></td>
<td align="center"><a href="https://github.com/Fointard"><img src="https://avatars.githubusercontent.com/u/9333398?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Fointard</b></sub></a><br /><a href="#content-Fointard" title="Content">🖋</a></td>
</tr>
</table>

View File

@@ -1,3 +1,24 @@
<a name="4.7.1"></a>
## 4.7.1 (2022-04-20)
#### Features
- The amount of dependency crates that need to be compiled went down from ~65 to
~45 by bumping dependency versions.
- The minimum Rust version in the install scripts has been bumped to 1.56.0 (this isn't in
the release itself, since install scripts don't really get versioned)
#### Bug Fixes
- **arc1**: A small part has been rewritten using a more functional code style (#968).
- **using_as**: A small part has been refactored to use `sum` instead of `fold`, resulting
in better readability.
#### Housekeeping
- The changelog will now be manually written instead of being automatically generated by the
Git log.
<a name="4.7.0"></a>
## 4.7.0 (2022-04-14)

142
Cargo.lock generated
View File

@@ -52,17 +52,6 @@ dependencies = [
"predicates-tree",
]
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi 0.3.9",
]
[[package]]
name = "autocfg"
version = "1.0.1"
@@ -87,45 +76,15 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clicolors-control"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e"
dependencies = [
"atty",
"lazy_static",
"libc",
"winapi 0.3.9",
]
[[package]]
name = "console"
version = "0.7.7"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ca57c2c14b8a2bf3105bc9d15574aad80babf6a9c44b1058034cdf8bd169628"
dependencies = [
"atty",
"clicolors-control",
"encode_unicode",
"lazy_static",
"libc",
"parking_lot",
"regex",
"termios",
"unicode-width",
"winapi 0.3.9",
]
[[package]]
name = "console"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3993e6445baa160675931ec041a5e03ca84b9c6e32a056150d3aa2bdda0a1f45"
checksum = "a28b32d32ca44b70c3e4acd7db1babf555fa026e385fb95f18028f88848b3c31"
dependencies = [
"encode_unicode",
"lazy_static",
"libc",
"once_cell",
"regex",
"terminal_size",
"unicode-width",
@@ -227,25 +186,15 @@ dependencies = [
"unicode-segmentation",
]
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "indicatif"
version = "0.10.3"
version = "0.16.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40ecd1e2ee08e6c255ce890f5a99d17000850e664e7acf119fb03b25b0575bfe"
checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b"
dependencies = [
"console 0.14.1",
"console",
"lazy_static",
"number_prefix",
"parking_lot",
"regex",
]
@@ -269,15 +218,6 @@ dependencies = [
"libc",
]
[[package]]
name = "instant"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d"
dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "iovec"
version = "0.1.4"
@@ -321,15 +261,6 @@ version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1fa8cddc8fbbee11227ef194b5317ed014b8acbf15139bd716a18ad3fe99ec5"
[[package]]
name = "lock_api"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb"
dependencies = [
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.14"
@@ -434,37 +365,15 @@ dependencies = [
[[package]]
name = "number_prefix"
version = "0.2.8"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee"
dependencies = [
"num-traits",
]
checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
[[package]]
name = "parking_lot"
version = "0.11.1"
name = "once_cell"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb"
dependencies = [
"instant",
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018"
dependencies = [
"cfg-if 1.0.0",
"instant",
"libc",
"redox_syscall",
"smallvec",
"winapi 0.3.9",
]
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
[[package]]
name = "predicates"
@@ -541,11 +450,11 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "rustlings"
version = "4.7.0"
version = "4.7.1"
dependencies = [
"argh",
"assert_cmd",
"console 0.7.7",
"console",
"glob",
"indicatif",
"notify",
@@ -570,12 +479,6 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "serde"
version = "1.0.129"
@@ -613,12 +516,6 @@ version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590"
[[package]]
name = "smallvec"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
[[package]]
name = "syn"
version = "1.0.75"
@@ -640,20 +537,11 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "termios"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "411c5bf740737c7918b8b1fe232dca4dc9f8e754b8ad5e20966814001ed0ac6b"
dependencies = [
"libc",
]
[[package]]
name = "toml"
version = "0.4.10"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
dependencies = [
"serde",
]

View File

@@ -1,17 +1,17 @@
[package]
name = "rustlings"
version = "4.7.0"
version = "4.7.1"
authors = ["mokou <mokou@fastmail.com>", "Carol (Nichols || Goulding) <carol.nichols@gmail.com>"]
edition = "2021"
[dependencies]
argh = "0.1.4"
indicatif = "0.10.3"
console = "0.7.7"
notify = "4.0.15"
toml = "0.4.10"
regex = "1.1.6"
serde = { version = "1.0.10", features = ["derive"] }
argh = "0.1"
indicatif = "0.16"
console = "0.15"
notify = "4.0"
toml = "0.5"
regex = "1.5"
serde= { version = "1.0", features = ["derive"] }
[[bin]]
name = "rustlings"

View File

@@ -8,7 +8,7 @@
// I AM NOT DONE
fn average(values: &[f64]) -> f64 {
let total = values.iter().fold(0.0, |a, b| a + b);
let total = values.iter().sum::<f64>();
total / values.len()
}

View File

@@ -32,12 +32,7 @@ fn main() {
for offset in 0..8 {
let child_numbers = // TODO
joinhandles.push(thread::spawn(move || {
let mut i = offset;
let mut sum = 0;
while i < child_numbers.len() {
sum += child_numbers[i];
i += 8;
}
let sum: u32 = child_numbers.iter().filter(|n| *n % 8 == offset).sum();
println!("Sum of offset {} is {}", offset, sum);
}));
}

View File

@@ -53,7 +53,7 @@ function vercomp($v1, $v2) {
}
$rustVersion = $(rustc --version).Split(" ")[1]
$minRustVersion = "1.39"
$minRustVersion = "1.56"
if ((vercomp $rustVersion $minRustVersion) -eq 2) {
Write-Host "WARNING: Rust version is too old: $rustVersion - needs at least $minRustVersion"
Write-Host "Please update Rust with 'rustup update'"

View File

@@ -100,7 +100,7 @@ function vercomp() {
}
RustVersion=$(rustc --version | cut -d " " -f 2)
MinRustVersion=1.39
MinRustVersion=1.56
vercomp "$RustVersion" $MinRustVersion || ec=$?
if [ ${ec:-0} -eq 2 ]
then

View File

@@ -24,7 +24,7 @@ mod run;
mod verify;
// In sync with crate version
const VERSION: &str = "4.7.0";
const VERSION: &str = "4.7.1";
#[derive(FromArgs, PartialEq, Debug)]
/// Rustlings is a collection of small exercises to get you used to writing and reading Rust code

View File

@@ -20,7 +20,7 @@ pub fn run(exercise: &Exercise, verbose: bool) -> Result<(), ()> {
// This is strictly for non-test binaries, so output is displayed
fn compile_and_run(exercise: &Exercise) -> Result<(), ()> {
let progress_bar = ProgressBar::new_spinner();
progress_bar.set_message(format!("Compiling {}...", exercise).as_str());
progress_bar.set_message(format!("Compiling {}...", exercise));
progress_bar.enable_steady_tick(100);
let compilation_result = exercise.compile();
@@ -37,7 +37,7 @@ fn compile_and_run(exercise: &Exercise) -> Result<(), ()> {
}
};
progress_bar.set_message(format!("Running {}...", exercise).as_str());
progress_bar.set_message(format!("Running {}...", exercise));
let result = compilation.run();
progress_bar.finish_and_clear();

View File

@@ -39,7 +39,7 @@ pub fn test(exercise: &Exercise, verbose: bool) -> Result<(), ()> {
// Invoke the rust compiler without running the resulting binary
fn compile_only(exercise: &Exercise) -> Result<bool, ()> {
let progress_bar = ProgressBar::new_spinner();
progress_bar.set_message(format!("Compiling {}...", exercise).as_str());
progress_bar.set_message(format!("Compiling {}...", exercise));
progress_bar.enable_steady_tick(100);
let _ = compile(exercise, &progress_bar)?;
@@ -52,12 +52,12 @@ fn compile_only(exercise: &Exercise) -> Result<bool, ()> {
// Compile the given Exercise and run the resulting binary in an interactive mode
fn compile_and_run_interactively(exercise: &Exercise) -> Result<bool, ()> {
let progress_bar = ProgressBar::new_spinner();
progress_bar.set_message(format!("Compiling {}...", exercise).as_str());
progress_bar.set_message(format!("Compiling {}...", exercise));
progress_bar.enable_steady_tick(100);
let compilation = compile(exercise, &progress_bar)?;
progress_bar.set_message(format!("Running {}...", exercise).as_str());
progress_bar.set_message(format!("Running {}...", exercise));
let result = compilation.run();
progress_bar.finish_and_clear();
@@ -80,7 +80,7 @@ fn compile_and_run_interactively(exercise: &Exercise) -> Result<bool, ()> {
// the output if verbose is set to true
fn compile_and_test(exercise: &Exercise, run_mode: RunMode, verbose: bool) -> Result<bool, ()> {
let progress_bar = ProgressBar::new_spinner();
progress_bar.set_message(format!("Testing {}...", exercise).as_str());
progress_bar.set_message(format!("Testing {}...", exercise));
progress_bar.enable_steady_tick(100);
let compilation = compile(exercise, &progress_bar)?;