Merge branch 'main' into main

pull/1848/head
liv 3 months ago committed by GitHub
commit 76acf613c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2559,6 +2559,87 @@
"contributions": [
"content"
]
},
{
"login": "AnonimAnonim2245",
"name": "Luca Plian",
"avatar_url": "https://avatars.githubusercontent.com/u/98339220?v=4",
"profile": "https://github.com/AnonimAnonim2245",
"contributions": [
"code"
]
},
{
"login": "reifenrath-dev",
"name": "René Reifenrath",
"avatar_url": "https://avatars.githubusercontent.com/u/18126097?v=4",
"profile": "https://reifenrath.dev/",
"contributions": [
"content"
]
},
{
"login": "peterneave",
"name": "Peter Neave",
"avatar_url": "https://avatars.githubusercontent.com/u/7982708?v=4",
"profile": "https://github.com/peterneave",
"contributions": [
"infra"
]
},
{
"login": "JanB1",
"name": "Jan",
"avatar_url": "https://avatars.githubusercontent.com/u/5552248?v=4",
"profile": "http://www.janb1.com",
"contributions": [
"content"
]
},
{
"login": "kylev",
"name": "Kyle VanderBeek",
"avatar_url": "https://avatars.githubusercontent.com/u/46888?v=4",
"profile": "http://www.kylev.com/",
"contributions": [
"infra"
]
},
{
"login": "pavedroad",
"name": "pavedroad",
"avatar_url": "https://avatars.githubusercontent.com/u/138004431?v=4",
"profile": "https://github.com/pavedroad",
"contributions": [
"content"
]
},
{
"login": "hyphena",
"name": "luna",
"avatar_url": "https://avatars.githubusercontent.com/u/26529488?v=4",
"profile": "https://github.com/hyphena",
"contributions": [
"content"
]
},
{
"login": "evanmiller2112",
"name": "Evan Miller",
"avatar_url": "https://avatars.githubusercontent.com/u/28488957?v=4",
"profile": "https://github.com/evanmiller2112",
"contributions": [
"content"
]
},
{
"login": "luvchurchill",
"name": "luvchurchill",
"avatar_url": "https://avatars.githubusercontent.com/u/46406654?v=4",
"profile": "https://github.com/luvchurchill",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 8,

@ -1,17 +1,8 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2-linux",
"waitFor": "onCreateCommand",
"onCreateCommand": ".devcontainer/setup.sh",
"updateContentCommand": "cargo build",
"postCreateCommand": "",
"postAttachCommand": {
"server": "rustlings watch"
},
"customizations": {
"vscode": {
"extensions": [
"rust-lang.rust-analyzer"
]
}
"image": "mcr.microsoft.com/devcontainers/rust:1",
"updateContentCommand": ["cargo", "build"],
"postAttachCommand": ["rustlings", "watch"],
"remoteEnv": {
"PATH": "${containerEnv:PATH}:${containerWorkspaceFolder}/target/debug"
}
}

@ -1,7 +0,0 @@
#!/bin/bash
curl https://sh.rustup.rs -sSf | sh -s -- -y
# Update current shell environment variables after install to find rustup
. "$HOME/.cargo/env"
rustup install stable
bash install.sh

2
.gitattributes vendored

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

@ -362,6 +362,17 @@ authors.
</tr>
<tr>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/gerases"><img src="https://avatars.githubusercontent.com/u/8953623?v=4?s=100" width="100px;" alt="gerases"/><br /><sub><b>gerases</b></sub></a><br /><a href="#content-gerases" title="Content">🖋</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/AnonimAnonim2245"><img src="https://avatars.githubusercontent.com/u/98339220?v=4?s=100" width="100px;" alt="Luca Plian"/><br /><sub><b>Luca Plian</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=AnonimAnonim2245" title="Code">💻</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://reifenrath.dev/"><img src="https://avatars.githubusercontent.com/u/18126097?v=4?s=100" width="100px;" alt="René Reifenrath"/><br /><sub><b>René Reifenrath</b></sub></a><br /><a href="#content-reifenrath-dev" title="Content">🖋</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/peterneave"><img src="https://avatars.githubusercontent.com/u/7982708?v=4?s=100" width="100px;" alt="Peter Neave"/><br /><sub><b>Peter Neave</b></sub></a><br /><a href="#infra-peterneave" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="12.5%"><a href="http://www.janb1.com"><img src="https://avatars.githubusercontent.com/u/5552248?v=4?s=100" width="100px;" alt="Jan"/><br /><sub><b>Jan</b></sub></a><br /><a href="#content-JanB1" title="Content">🖋</a></td>
<td align="center" valign="top" width="12.5%"><a href="http://www.kylev.com/"><img src="https://avatars.githubusercontent.com/u/46888?v=4?s=100" width="100px;" alt="Kyle VanderBeek"/><br /><sub><b>Kyle VanderBeek</b></sub></a><br /><a href="#infra-kylev" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/pavedroad"><img src="https://avatars.githubusercontent.com/u/138004431?v=4?s=100" width="100px;" alt="pavedroad"/><br /><sub><b>pavedroad</b></sub></a><br /><a href="#content-pavedroad" title="Content">🖋</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/hyphena"><img src="https://avatars.githubusercontent.com/u/26529488?v=4?s=100" width="100px;" alt="luna"/><br /><sub><b>luna</b></sub></a><br /><a href="#content-hyphena" title="Content">🖋</a></td>
</tr>
<tr>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/evanmiller2112"><img src="https://avatars.githubusercontent.com/u/28488957?v=4?s=100" width="100px;" alt="Evan Miller"/><br /><sub><b>Evan Miller</b></sub></a><br /><a href="#content-evanmiller2112" title="Content">🖋</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/luvchurchill"><img src="https://avatars.githubusercontent.com/u/46406654?v=4?s=100" width="100px;" alt="luvchurchill"/><br /><sub><b>luvchurchill</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=luvchurchill" title="Code">💻</a></td>
</tr>
</tbody>
</table>

@ -167,7 +167,7 @@
- **structs3**: Clarifed the hint
- **quiz2, as_ref_mut, options1, traits1, traits2**: Clarified hints
- **traits1, traits2, cli**: Tidied up unmatching backticks
- **enums2**: Removed unneccessary indirection of self
- **enums2**: Removed unnecessary indirection of self
- **enums3**: Added an extra tuple comment
#### Housekeeping

4
Cargo.lock generated

@ -390,9 +390,9 @@ checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
[[package]]
name = "mio"
version = "0.8.9"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0"
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
dependencies = [
"libc",
"log",

@ -4,10 +4,11 @@
// the form : "<team_1_name>,<team_2_name>,<team_1_goals>,<team_2_goals>"
// Example: England,France,4,2 (England scored 4 goals, France 2).
//
// You have to build a scores table containing the name of the team, goals the
// team scored, and goals the team conceded. One approach to build the scores
// table is to use a Hashmap. The solution is partially written to use a
// Hashmap, complete it to pass the test.
// You have to build a scores table containing the name of the team, the total
// number of goals the team scored, and the total number of goals the team
// conceded. One approach to build the scores table is to use a Hashmap.
// The solution is partially written to use a Hashmap,
// complete it to pass the test.
//
// Make me pass the tests!
//

@ -24,7 +24,8 @@ impl Default for Person {
}
}
// Your task is to complete this implementation in order for the line `let p =
// Your task is to complete this implementation in order for the line `let p1 =
// Person::from("Mark,20")` to compile. Please note that you'll need to parse the
// age component into a `usize` with something like `"4".parse::<usize>()`. The
// outcome of this needs to be handled appropriately.
@ -43,8 +44,7 @@ impl Default for Person {
// I AM NOT DONE
impl From<&str> for Person {
fn from(s: &str) -> Person {
}
fn from(s: &str) -> Person {}
}
fn main() {
@ -127,14 +127,14 @@ mod tests {
#[test]
fn test_trailing_comma() {
let p: Person = Person::from("Mike,32,");
assert_eq!(p.name, "Mike");
assert_eq!(p.age, 32);
assert_eq!(p.name, "John");
assert_eq!(p.age, 30);
}
#[test]
fn test_trailing_comma_and_some_string() {
let p: Person = Person::from("Mike,32,man");
assert_eq!(p.name, "Mike");
assert_eq!(p.age, 32);
let p: Person = Person::from("Mike,32,dog");
assert_eq!(p.name, "John");
assert_eq!(p.age, 30);
}
}

@ -145,7 +145,7 @@ after the `->`. This is where the function's return type should be -- take a
look at the `is_even` function for an example!
Also: Did you figure out that, technically, `u32` would be the more fitting type
for the prices here, since they can't be negative? If so, kudos!"""
for the inputs of the functions here, since the original prices shouldn't be negative? If so, kudos!"""
[[exercises]]
name = "functions5"
@ -248,7 +248,7 @@ starting and ending (plus one) indices of the items in the `Array` that you
want to end up in the slice.
If you're curious why the first argument of `assert_eq!` does not have an
ampersand for a reference since the second argument is areference, take a look
ampersand for a reference since the second argument is a reference, take a look
at the coercion chapter of the nomicon:
https://doc.rust-lang.org/nomicon/coercions.html"""

@ -137,7 +137,7 @@ fi
Path=${1:-rustlings/}
echo "Cloning Rustlings at $Path..."
git clone -q https://github.com/rust-lang/rustlings "$Path"
git clone -q https://github.com/rust-lang/rustlings.git "$Path"
cd "$Path"

@ -1,33 +1,28 @@
macro_rules! warn {
($fmt:literal, $ex:expr) => {{
macro_rules! print_emoji {
($emoji:expr, $sign:expr, $color: ident ,$fmt:literal, $ex:expr) => {{
use console::{style, Emoji};
use std::env;
let formatstr = format!($fmt, $ex);
if env::var("NO_EMOJI").is_ok() {
println!("{} {}", style("!").red(), style(formatstr).red());
println!("{} {}", style($sign).$color(), style(formatstr).$color());
} else {
println!(
"{} {}",
style(Emoji("⚠️ ", "!")).red(),
style(formatstr).red()
style(Emoji($emoji, $sign)).$color(),
style(formatstr).$color()
);
}
}};
}
macro_rules! warn {
($fmt:literal, $ex:expr) => {{
print_emoji!("⚠️ ", "!", red, $fmt, $ex);
}};
}
macro_rules! success {
($fmt:literal, $ex:expr) => {{
use console::{style, Emoji};
use std::env;
let formatstr = format!($fmt, $ex);
if env::var("NO_EMOJI").is_ok() {
println!("{} {}", style("✓").green(), style(formatstr).green());
} else {
println!(
"{} {}",
style(Emoji("✅", "✓")).green(),
style(formatstr).green()
);
}
print_emoji!("✅ ", "✓", green, $fmt, $ex);
}};
}

Loading…
Cancel
Save