Skip to content

Reverse String: Confusing Hint for Bonus TestsΒ #2119

@nitwhiz

Description

@nitwhiz

One of the first things you learn about Rust strings is that they are a valid UTF-8 sequence.

The hint about grapheme clusters made me question reality. The tools to iterate characters are there since 1.0.0, even though the random forum posts you find when googling "rust grapheme clusters" suggest something else.

IMHO, having such a niche big brain flex right in the first exercises isn't helpful and steers you away from using a standard language feature. (That being being input.chars()) - Also, one of the tests outside of the grapheme feature is already using wide characters, so byte-by-byte reversing already fails without the bonus tests.

Ref:

Test your function on this string: `uüu` and see what happens.
Try to write a function that properly reverses this string.
Hint: grapheme clusters
To get the bonus test to run, remove the ignore flag (`#[ignore]`) from the last test, and execute the tests with:
```bash
cargo test --features grapheme
```
You will need to use external libraries (a `crate` in rust lingo) for the bonus task.

I suggest to just remove the "Hint: grapheme clusters" and the sentence about the need for a crate. Calling the feature grapheme is alright, as this is the right place for gimmicky names.

I understand that this might've felt like the right place to introduce external crates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions