Tests don't pass when sending Cargo.toml with optional dependency


I have been working on reverse-string issue. Looking at the Cargo.toml file, it contains [features] grapheme entry, which lead me to believe I can add an optional dependency to the feature. So I did -


unicode-segmentation = { version = "1.7.1", optional = true }

grapheme = ["dep:unicode-segmentation"]

edition = "2021"
name = "reverse_string"
version = "1.2.0"

I was expecting tests that don’t have #[cfg(feature = "grapheme")] annotation to run fine but after submitting my solution to the website, they all fail due to compiler not finding the crate for non-annotated tests.

Exercism test output -

Compiling reverse_string v1.2.0 (/mnt/exercism-iteration)
error[E0432]: unresolved import `unicode_segmentation`
 --> src/lib.rs:4:13
4 |         use unicode_segmentation::UnicodeSegmentation;
  |             ^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `unicode_segmentation`

error[E0599]: no method named `graphemes` found for reference `&str` in the current scope
 --> src/lib.rs:5:22
5 |         return input.graphemes(true).rev().collect::<String>();
  |                      ^^^^^^^^^ method not found in `&str`

Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `reverse_string` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `reverse_string` due to 2 previous errors

And here’s my solution to the problem -

pub fn reverse(input: &str) -> String {
    if cfg!(feature = "grapheme") {
        use unicode_segmentation::UnicodeSegmentation;
        return input.graphemes(true).rev().collect::<String>();

    return input.chars().rev().collect::<String>();

It works fine on my machine (said every developer ever), I assume that the tests that are ran on the exercism end are not running with --all-features flag or something or am I doing something wrong here?

Local env versions -
cargo 1.72.0 (103a7ff2e 2023-08-15)
rustc 1.72.0 (5680fa18f 2023-08-23)