Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

poneciak57
Copy link
Contributor

Created a new pull request based on the previous one (#1470).

Added a new generic exercise that focuses on function reusability using generics.

@poneciak57
Copy link
Contributor Author

poneciak57 commented Jul 11, 2024

One of the checks failed Rustlings Tests / dev-check (pull_request)
It told me to run command cargo run -- dev update but this failed should i open an issue or should i just update this file manually ?

windows 11
rustup 1.27.1
cargo 1.79.0
Error message:

cargo run -- dev update
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.18s
     Running `target\debug\rustlings.exe dev update`
Error: Failed to update the file `dev/Cargo.toml`

Caused by:
    Failed to find the start of the `bin` list (`bin = [`)
error: process didn't exit successfully: `target\debug\rustlings.exe dev update` (exit code: 1)

@mo8it
Copy link
Contributor

mo8it commented Jul 12, 2024

I can take care of the CI test later. Probably a Windows issue.

We shouldn't use traits / trait bounds because the exercises about them are after the generics exercises.

How about a function taking &[Option<T>] and returning Vec<T> containing only the Some values?

@poneciak57
Copy link
Contributor Author

I changed stringify to this:

fn into_dispose_nulls<T>(list: Vec<Option<T>>) -> Vec<T> {
    list.into_iter().flatten().collect()
}

i tried to have &[Option<T>] as an argument but it requires T to implement Clone (and i couldn't find any suitable workaround)

@mo8it
Copy link
Contributor

mo8it commented Jul 12, 2024

i tried to have &[Option] as an argument but it requires T to implement Clone (and i couldn't find any suitable workaround)

Oh, yeah. We would need to return something like Vec<&T> otherwise. But this is fine how you did it with Vec as argument.

@mo8it mo8it added this to the v7 milestone Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.