Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace spec indices search with regex #166

Merged
merged 1 commit into from
Oct 6, 2023

Conversation

kossnikita
Copy link
Contributor

This allows you to search for indices regardless of the order of [], * and ?
Causes panic if the expression does not match the regex. For example, if it contains no or more than one token. This can be avoided if the function returns an option.

@kossnikita kossnikita marked this pull request as draft October 5, 2023 10:38
@kossnikita kossnikita force-pushed the spec-ind-regex branch 3 times, most recently from eaa93d2 to 73ea3e3 Compare October 5, 2023 11:56
@burrbull
Copy link
Member

burrbull commented Oct 5, 2023

Could you add several examples of supported expressions inside spec_ind docs?

@burrbull
Copy link
Member

burrbull commented Oct 5, 2023

  1. Lets replace match panic with PatchResult.
  2. It's better to compile regexpr once: see
    static RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"\s*\n\s*").unwrap());
  3. Fix example. See CI error

@kossnikita
Copy link
Contributor Author

About tests, I'm not very good at this. I can't use private functions in doctest? If not can I just use compile_fail for this?

@burrbull
Copy link
Member

burrbull commented Oct 5, 2023

You can just ignore it: https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#attributes

@kossnikita kossnikita force-pushed the spec-ind-regex branch 3 times, most recently from 0246f1e to f4b6457 Compare October 5, 2023 20:07
@kossnikita kossnikita marked this pull request as ready for review October 6, 2023 03:49
@burrbull burrbull added this pull request to the merge queue Oct 6, 2023
Merged via the queue into rust-embedded:master with commit 4e12ba7 Oct 6, 2023
13 checks passed
@kossnikita kossnikita deleted the spec-ind-regex branch October 6, 2023 09:39
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.

2 participants