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

More generic impl of Replacer for closures #1048

Closed
wants to merge 13 commits into from

Commits on Jul 20, 2023

  1. More generic impl of Replacer for closures

    Implement `Replacer` also for closures that return a type which depends
    on lifetime of the argument. This allows performing a no-op replacement
    where the closure returns the whole match, for example, without needing
    to clone the captured string.
    JanBeh committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    f73db82 View commit details
    Browse the repository at this point in the history
  2. fixup! More generic impl of Replacer for closures

    Fixed code formatting using rustfmt.
    JanBeh committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    b6a612d View commit details
    Browse the repository at this point in the history
  3. fixup! More generic impl of Replacer for closures

    Less generic implementation, which results in a better documented API.
    JanBeh committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    092b770 View commit details
    Browse the repository at this point in the history
  4. fixup! More generic impl of Replacer for closures

    Do not use the same lifetime for reference and type parameter of
    `Captures`.
    JanBeh committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    adf66a8 View commit details
    Browse the repository at this point in the history
  5. fixup! More generic impl of Replacer for closures

    Hide `ReplacerClosure` trait as an implementation detail and describe
    for which closures the `Replacer` trait is implemented in the
    documentation instead.
    
    Added documentation tests.
    JanBeh committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    a40d8f5 View commit details
    Browse the repository at this point in the history
  6. fixup! More generic impl of Replacer for closures

    Fixed error in documentation comment in private module.
    JanBeh committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    de48780 View commit details
    Browse the repository at this point in the history
  7. fixup! More generic impl of Replacer for closures

    Ignore documentation test that needs unstable Rust.
    JanBeh committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    4451505 View commit details
    Browse the repository at this point in the history
  8. fixup! More generic impl of Replacer for closures

    Do not use closure lifetime binder but helper function for coercion in
    documentation test.
    JanBeh committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    43222f2 View commit details
    Browse the repository at this point in the history
  9. fixup! More generic impl of Replacer for closures

    Added documentation comment on `Replacer` impl for closures.
    JanBeh committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    2c8c8dd View commit details
    Browse the repository at this point in the history

Commits on Jul 21, 2023

  1. fixup! More generic impl of Replacer for closures

    Removed unnecessary import of `Replacer` in doc test.
    JanBeh committed Jul 21, 2023
    Configuration menu
    Copy the full SHA
    657dab8 View commit details
    Browse the repository at this point in the history
  2. fixup! More generic impl of Replacer for closures

    Use same lifetime for reference and type parameter of `Captures` (again)
    because `Captures<'a>` is covariant over `'a`. This covers closures that
    accept a `&'a Captures<'b>` as argument and have a result type that
    depends either on `'b` or `'a`. Documentation was updated and
    corresponding test cases have been added to `tests/misc.rs`.
    
    A link to the blanket implementation has been added to the
    "Implementation by closures" section of the documentation on `Replacer`.
    JanBeh committed Jul 21, 2023
    Configuration menu
    Copy the full SHA
    664a0f2 View commit details
    Browse the repository at this point in the history

Commits on Jul 22, 2023

  1. fixup! More generic impl of Replacer for closures

    Refactored code to be able to use two different lifetimes `'a` and `'b`
    for the `&'a Captures<'b>` argument while allowing the return type to
    depend on either `'a` or `'b`.
    JanBeh committed Jul 22, 2023
    Configuration menu
    Copy the full SHA
    d89b31a View commit details
    Browse the repository at this point in the history
  2. fixup! More generic impl of Replacer for closures

    Do not mention unstable features in documentation. Do not include
    coercing helper function in example code.
    JanBeh committed Jul 22, 2023
    Configuration menu
    Copy the full SHA
    1aab0b8 View commit details
    Browse the repository at this point in the history