Missing fmt::Debug impls for public structs and enums #735
Conversation
LGTM, but like the other PR, my sense is that some of these impls aren't needed to pass the lint? Or does the lint apply to internal types too? The reason why I'm being a stickler about this is that I'd rather not add impls for things that we don't need because they likely increase compile times. And the compile times for this crate are already pretty poor. |
.field("last_match", &self.last_match) | ||
.finish() | ||
} | ||
} |
BurntSushi
Dec 29, 2020
Member
I suspect you're writing out this impl because Matches
is generic and doesn't require its type parameters to impl Debug
? The RegularExpression
trait is an internal construct, so adding a requirement to impl Debug
seems fine to me. (For both Self
and for its Text
associated type.) Then you should be able to derive Debug
impls here.
I suspect you're writing out this impl because Matches
is generic and doesn't require its type parameters to impl Debug
? The RegularExpression
trait is an internal construct, so adding a requirement to impl Debug
seems fine to me. (For both Self
and for its Text
associated type.) Then you should be able to derive Debug
impls here.
lopopolo
Dec 29, 2020
Author
Contributor
I also made the same change to CaptureMatches
.
I also made the same change to CaptureMatches
.
@@ -97,6 +99,7 @@ struct ExecReadOnly { | |||
/// Facilitates the construction of an executor by exposing various knobs | |||
/// to control how a regex is executed and what kinds of resources it's | |||
/// permitted to use. | |||
#[derive(Debug)] |
BurntSushi
Dec 29, 2020
Member
Is this Debug
impl necessary?
Is this Debug
impl necessary?
lopopolo
Dec 29, 2020
Author
Contributor
ExecBuilder
is public via the internal
module which "exists to support suspicious activity".
I'll remove the debug impl and allow the lint.
ExecBuilder
is public via the internal
module which "exists to support suspicious activity".
I'll remove the debug impl and allow the lint.
@@ -25,6 +26,7 @@ struct Patch { | |||
|
|||
/// A compiler translates a regular expression AST to a sequence of | |||
/// instructions. The sequence of instructions represents an NFA. | |||
#[derive(Debug)] |
BurntSushi
Dec 29, 2020
Member
Is this Debug
impl necessary?
Is this Debug
impl necessary?
lopopolo
Dec 29, 2020
Author
Contributor
Compiler
is public via the internal module which "exists to support suspicious activity".
I'll remove the debug impl and allow the lint.
Compiler
is public via the internal module which "exists to support suspicious activity".
I'll remove the debug impl and allow the lint.
BurntSushi
Dec 29, 2020
Member
Haha right. Yeah, it's technically public, but is doc(hidden)
and not a stable part of the API. I'm hoping to remove that quirk in the move to regex-automata
.
Thanks.
Haha right. Yeah, it's technically public, but is doc(hidden)
and not a stable part of the API. I'm hoping to remove that quirk in the move to regex-automata
.
Thanks.
Whoops, I meant to "request changes." |
@BurntSushi I've made the requested changes. I squashed these into the commit for the For types that are only public via the hidden |
rebase incoming. |
For reference, the other PR is #734. |
OK, LGTM, thanks! |
Whoops looks like I accidentally didn't split out the iterator traits bits from Thanks for merging. Would it be possible to get these two PRs packaged into a release soon? |
Yeah I saw that, but that's okay. No biggie. I'll try to do a release in the next couple days. Please ping me again if it doesn't happen. |
hi @BurntSushi following up with a friendly ping for a release. |
@lopopolo OK, |
Thank you! |
rust-lang/regex#735 added missing `fmt::Debug` impls for public structs and enums, which `spinoso-regexp` requires to impl `fmt::Debug` on its own iterator types. This change does not use these `fmt::Debug` impls, just updated the minimum dependency version.
The Rust API guidelines advise that all public types implement common
std
traits for interoperability, of whichfmt::Debug
is one.This PR adds
fmt::Debug
implementations for all public types inregex
andregex-syntax
crates. This PR also adds#![warn(missing_debug_implementations)]
tolib.rs
in each crate.This PR also opportunistically implements
Clone
on iterators that wrapslice::Iter
.Context: I'm building an implementation of Ruby
Regexp
on top of theregex
crate, and having all public types implementfmt::Debug
will allow me to#[derive(Debug)]
on types that wrap e.g. iterators in this crate.