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

Compare commits

...

12 Commits
1.4.0 ... 1.4.1

Author SHA1 Message Date
marisa
4f0c5a8d49 1.4.1 2019-08-13 11:59:17 +02:00
bors
3011251da7 Auto merge of #208 - EnricoMiccoli:patch-1, r=komaeda
chore: Correct typo in hint text
2019-08-12 15:24:17 +00:00
Enrico Miccoli
76b4cb5c00 chore: Correct typo 2019-08-12 11:45:40 +02:00
bors
f83af3c25d Auto merge of #207 - nkanderson:fix_iterators2, r=komaeda
Fix iterators2

A couple of small changes to the `iterators2` exercise. @Jesse-Cameron, it looks like you contributed this exercise, so I wanted to check and see if these changes are in line with your intentions. Happy to adjust if they're not :)
2019-08-11 15:44:40 +00:00
Niklas Anderson
e3931718fb chore(iterators2): Add exercise instructions 2019-08-09 07:38:21 -07:00
Niklas Anderson
4cde86643e fix(iterators2): Remove syntax resulting in misleading error message
closes #199
2019-08-09 07:37:27 -07:00
bors
e696a07190 Auto merge of #201 - zdzc:patch-1, r=komaeda
docs: Fix wrong title

fix #200
2019-07-27 19:07:22 +00:00
Andre Pratama
e0db987441 docs: Fix wrong title
fix #200
2019-07-27 22:14:48 +07:00
bors
1890b0019d Auto merge of #198 - nkanderson:160_options1-add-test, r=komaeda
fix(option1): Add test for prematurely passing exercise

Fixes the bug referenced in #160, but does not address the larger feature work referenced by the issue.
2019-07-27 10:32:47 +00:00
Niklas Anderson
a750e4a1a3 fix(option1): Add test for prematurely passing exercise
Fixes the bug referenced in #160, but does not address the larger feature work referenced by the issue.
2019-07-26 16:58:12 -07:00
bors
1c789dda08 Auto merge of #192 - petemcfarlane:patch-2, r=komaeda
fix(test1): Swap assertion parameter order

`Expected` should come before `actual`, other wise it leads to confusing compiler messages, e.g.
```
note: expected type `()`
         found type `{integer}`
```
There may be other tests that need updating, but this is as far as I am through the Rustlings course right now :)
2019-07-13 16:27:14 +00:00
Pete McFarlane
4086d463a9 fix(test1): Swap assertion parameter order
`Expected` should come before `actual`, other wise it leads to confusing compiler messages, e.g.
```
note: expected type `()`
         found type `{integer}`
```
2019-07-13 13:31:57 +01:00
7 changed files with 30 additions and 9 deletions

View File

@@ -1,3 +1,15 @@
<a name="1.4.1"></a>
### 1.4.1 (2019-08-13)
#### Bug Fixes
* **iterators2:** Remove syntax resulting in misleading error message ([4cde8664](https://github.com/rust-lang/rustlings/commit/4cde86643e12db162a66e62f23b78962986046ac))
* **option1:** Add test for prematurely passing exercise ([a750e4a1](https://github.com/rust-lang/rustlings/commit/a750e4a1a3006227292bb17d57d78ce84da6bfc6))
* **test1:** Swap assertion parameter order ([4086d463](https://github.com/rust-lang/rustlings/commit/4086d463a981e81d97781851d17db2ced290f446))
<a name="1.4.0"></a>
## 1.4.0 (2019-07-13)

View File

@@ -1,6 +1,6 @@
[package]
name = "rustlings"
version = "1.4.0"
version = "1.4.1"
authors = ["Marisa <marisa@mokou.zone>", "Carol (Nichols || Goulding) <carol.nichols@gmail.com"]
edition = "2018"

View File

@@ -4,7 +4,7 @@
// on `None`. Handle this in a more graceful way than calling `unwrap`!
// Scroll down for hints :)
fn main() {
pub fn pop_too_much() -> bool {
let mut list = vec![3];
let last = list.pop().unwrap();
@@ -15,9 +15,18 @@ fn main() {
"The second-to-last item in the list is {:?}",
second_to_last
);
true
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn should_not_panic() {
assert!(pop_too_much(), true);
}
}

View File

@@ -1,7 +1,7 @@
// iterators2.rs
// In this module, you'll learn some of unique advantages that iterators can offer
// Step 1. Complete the `capitalize_first` function to pass the first two cases
// Step 2. Apply the `capitalize_first` function to a vector of strings, ensuring that it
// Step 2. Apply the `capitalize_first` function to a vector of strings, ensuring that it returns a vector of strings as well
// Step 3. Apply the `capitalize_first` function again to a list, but try and ensure it returns a single string
// As always, there are hints below!
@@ -9,7 +9,7 @@ pub fn capitalize_first(input: &str) -> String {
let mut c = input.chars();
match c.next() {
None => String::new(),
Some(first) => first.collect()::<String>() + c.as_str(),
Some(first) => first.collect::<String>() + c.as_str(),
}
}
@@ -78,7 +78,7 @@ mod tests {
// Step 1
// You need to call something on `first` before it can be collected
// Currently it's type is `char`. Have a look at the methods that are available on that type:
// Currently its type is `char`. Have a look at the methods that are available on that type:
// https://doc.rust-lang.org/std/primitive.char.html

View File

@@ -1,4 +1,4 @@
### Strings
### Structs
Rust has three struct types: a classic c struct, a tuple struct, and a unit struct.

View File

@@ -16,6 +16,6 @@ fn verify_test() {
let price1 = calculate_price(55);
let price2 = calculate_price(40);
assert_eq!(price1, 55);
assert_eq!(price2, 80);
assert_eq!(55, price1);
assert_eq!(80, price2);
}

View File

@@ -192,7 +192,7 @@ mode = "test"
[[exercises]]
path = "exercises/error_handling/option1.rs"
mode = "compile"
mode = "test"
[[exercises]]
path = "exercises/error_handling/result1.rs"