Implementing Regex in Cargo.toml

I have multiple projects in the Rust folder and I want to avoid writing the project name explicitly so I replaced it with rust/* but rust-analyzer gave me an error.

// Cargo.toml

members = ["rust/*"]
exclude = ["typescript"]

The TOML format does not define a regex type, so I'm not sure why you expected such functionality to exist. In addition, the purpose of a workspace manifest is to explicitly list the members it contains, so a regex-based approach would be self-defeating.

Just list each project, it's the simple thing to do that works.

Cargo does support globs when reading [workspace.members]:

The members list also supports globs to match multiple paths, using typical filename glob patterns like * and ?.

What error are you getting? Is it just rust-analyzer or does cargo check also give you an error?


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.