diff -Nru rust-grep-matcher-0.1.6/.cargo_vcs_info.json rust-grep-matcher-0.1.7/.cargo_vcs_info.json --- rust-grep-matcher-0.1.6/.cargo_vcs_info.json 1970-01-01 00:00:01.000000000 +0000 +++ rust-grep-matcher-0.1.7/.cargo_vcs_info.json 1970-01-01 00:00:01.000000000 +0000 @@ -1,6 +1,6 @@ { "git": { - "sha1": "bc78c644db115de518a083e192312da77cfffdca" + "sha1": "d0251c77fe96412310110aeb9383f20436a9f97e" }, "path_in_vcs": "crates/matcher" } \ No newline at end of file diff -Nru rust-grep-matcher-0.1.6/Cargo.toml rust-grep-matcher-0.1.7/Cargo.toml --- rust-grep-matcher-0.1.6/Cargo.toml 1970-01-01 00:00:01.000000000 +0000 +++ rust-grep-matcher-0.1.7/Cargo.toml 1970-01-01 00:00:01.000000000 +0000 @@ -10,9 +10,9 @@ # See Cargo.toml.orig for the original contents. [package] -edition = "2018" +edition = "2021" name = "grep-matcher" -version = "0.1.6" +version = "0.1.7" authors = ["Andrew Gallant "] autotests = false description = """ @@ -34,7 +34,7 @@ path = "tests/tests.rs" [dependencies.memchr] -version = "2.1" +version = "2.6.3" [dev-dependencies.regex] -version = "1.1" +version = "1.9.5" diff -Nru rust-grep-matcher-0.1.6/Cargo.toml.orig rust-grep-matcher-0.1.7/Cargo.toml.orig --- rust-grep-matcher-0.1.6/Cargo.toml.orig 2006-07-24 01:21:28.000000000 +0000 +++ rust-grep-matcher-0.1.7/Cargo.toml.orig 2006-07-24 01:21:28.000000000 +0000 @@ -1,6 +1,6 @@ [package] name = "grep-matcher" -version = "0.1.6" #:version +version = "0.1.7" #:version authors = ["Andrew Gallant "] description = """ A trait for regular expressions, with a focus on line oriented search. @@ -12,13 +12,13 @@ keywords = ["regex", "pattern", "trait"] license = "Unlicense OR MIT" autotests = false -edition = "2018" +edition = "2021" [dependencies] -memchr = "2.1" +memchr = "2.6.3" [dev-dependencies] -regex = "1.1" +regex = "1.9.5" [[test]] name = "integration" diff -Nru rust-grep-matcher-0.1.6/debian/cargo-checksum.json rust-grep-matcher-0.1.7/debian/cargo-checksum.json --- rust-grep-matcher-0.1.6/debian/cargo-checksum.json 2023-06-12 20:22:38.000000000 +0000 +++ rust-grep-matcher-0.1.7/debian/cargo-checksum.json 2023-11-26 21:38:38.000000000 +0000 @@ -1 +1 @@ -{"package":"3902ca28f26945fe35cad349d776f163981d777fee382ccd6ef451126f51b319","files":{}} +{"package":"47a3141a10a43acfedc7c98a60a834d7ba00dfe7bec9071cbfc19b55b292ac02","files":{}} diff -Nru rust-grep-matcher-0.1.6/debian/changelog rust-grep-matcher-0.1.7/debian/changelog --- rust-grep-matcher-0.1.6/debian/changelog 2023-06-12 20:22:38.000000000 +0000 +++ rust-grep-matcher-0.1.7/debian/changelog 2023-11-26 21:38:38.000000000 +0000 @@ -1,3 +1,10 @@ +rust-grep-matcher (0.1.7-1) unstable; urgency=medium + + * Team upload. + * Package grep-matcher 0.1.7 from crates.io using debcargo 2.6.1 + + -- Peter Michael Green Sun, 26 Nov 2023 21:38:38 +0000 + rust-grep-matcher (0.1.6-1) unstable; urgency=medium * Team upload. diff -Nru rust-grep-matcher-0.1.6/debian/control rust-grep-matcher-0.1.7/debian/control --- rust-grep-matcher-0.1.6/debian/control 2023-06-12 20:22:38.000000000 +0000 +++ rust-grep-matcher-0.1.7/debian/control 2023-11-26 21:38:38.000000000 +0000 @@ -6,11 +6,11 @@ cargo:native , rustc:native , libstd-rust-dev , - librust-memchr-2+default-dev (>= 2.1-~~) + librust-memchr-2+default-dev (>= 2.6.3-~~) Maintainer: Debian Rust Maintainers Uploaders: kpcyrd -Standards-Version: 4.6.1 +Standards-Version: 4.6.2 Vcs-Git: https://salsa.debian.org/rust-team/debcargo-conf.git [src/grep-matcher] Vcs-Browser: https://salsa.debian.org/rust-team/debcargo-conf/tree/master/src/grep-matcher Homepage: https://github.com/BurntSushi/ripgrep/tree/master/crates/matcher @@ -22,15 +22,14 @@ Multi-Arch: same Depends: ${misc:Depends}, - librust-memchr-2+default-dev (>= 2.1-~~) + librust-memchr-2+default-dev (>= 2.6.3-~~) Provides: librust-grep-matcher+default-dev (= ${binary:Version}), librust-grep-matcher-0-dev (= ${binary:Version}), librust-grep-matcher-0+default-dev (= ${binary:Version}), librust-grep-matcher-0.1-dev (= ${binary:Version}), librust-grep-matcher-0.1+default-dev (= ${binary:Version}), - librust-grep-matcher-0.1.6-dev (= ${binary:Version}), - librust-grep-matcher-0.1.6+default-dev (= ${binary:Version}) + librust-grep-matcher-0.1.7-dev (= ${binary:Version}), + librust-grep-matcher-0.1.7+default-dev (= ${binary:Version}) Description: Trait for regular expressions for line oriented search - Rust source code - This package contains the source for the Rust grep-matcher crate, packaged by - debcargo for use with cargo and dh-cargo. + Source code for Debianized Rust crate "grep-matcher" diff -Nru rust-grep-matcher-0.1.6/debian/tests/control rust-grep-matcher-0.1.7/debian/tests/control --- rust-grep-matcher-0.1.6/debian/tests/control 2023-06-12 20:22:38.000000000 +0000 +++ rust-grep-matcher-0.1.7/debian/tests/control 2023-11-26 21:38:38.000000000 +0000 @@ -1,14 +1,14 @@ -Test-Command: /usr/share/cargo/bin/cargo-auto-test grep-matcher 0.1.6 --all-targets --all-features +Test-Command: /usr/share/cargo/bin/cargo-auto-test grep-matcher 0.1.7 --all-targets --all-features Features: test-name=rust-grep-matcher:@ -Depends: dh-cargo (>= 18), librust-regex-1+default-dev (>= 1.1-~~), @ +Depends: dh-cargo (>= 18), librust-regex-1+default-dev (>= 1.9.5-~~), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test grep-matcher 0.1.6 --all-targets +Test-Command: /usr/share/cargo/bin/cargo-auto-test grep-matcher 0.1.7 --all-targets Features: test-name=librust-grep-matcher-dev:default -Depends: dh-cargo (>= 18), librust-regex-1+default-dev (>= 1.1-~~), @ +Depends: dh-cargo (>= 18), librust-regex-1+default-dev (>= 1.9.5-~~), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test grep-matcher 0.1.6 --all-targets --no-default-features +Test-Command: /usr/share/cargo/bin/cargo-auto-test grep-matcher 0.1.7 --all-targets --no-default-features Features: test-name=librust-grep-matcher-dev: -Depends: dh-cargo (>= 18), librust-regex-1+default-dev (>= 1.1-~~), @ +Depends: dh-cargo (>= 18), librust-regex-1+default-dev (>= 1.9.5-~~), @ Restrictions: allow-stderr, skip-not-installable diff -Nru rust-grep-matcher-0.1.6/src/interpolate.rs rust-grep-matcher-0.1.7/src/interpolate.rs --- rust-grep-matcher-0.1.6/src/interpolate.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-grep-matcher-0.1.7/src/interpolate.rs 2006-07-24 01:21:28.000000000 +0000 @@ -1,5 +1,3 @@ -use std::str; - use memchr::memchr; /// Interpolate capture references in `replacement` and write the interpolation @@ -12,6 +10,7 @@ /// of a capture group reference and is expected to resolve the index to its /// corresponding matched text. If no such match exists, then `append` should /// not write anything to its given buffer. +#[inline] pub fn interpolate( mut replacement: &[u8], mut append: A, @@ -77,12 +76,14 @@ } impl<'a> From<&'a str> for Ref<'a> { + #[inline] fn from(x: &'a str) -> Ref<'a> { Ref::Named(x) } } impl From for Ref<'static> { + #[inline] fn from(x: usize) -> Ref<'static> { Ref::Number(x) } @@ -92,6 +93,7 @@ /// starting at the beginning of `replacement`. /// /// If no such valid reference could be found, None is returned. +#[inline] fn find_cap_ref(replacement: &[u8]) -> Option> { let mut i = 0; if replacement.len() <= 1 || replacement[0] != b'$' { @@ -114,7 +116,7 @@ // therefore be valid UTF-8. If we really cared, we could avoid this UTF-8 // check with an unchecked conversion or by parsing the number straight // from &[u8]. - let cap = str::from_utf8(&replacement[i..cap_end]) + let cap = std::str::from_utf8(&replacement[i..cap_end]) .expect("valid UTF-8 capture name"); if brace { if !replacement.get(cap_end).map_or(false, |&b| b == b'}') { @@ -132,6 +134,7 @@ } /// Returns true if and only if the given byte is allowed in a capture name. +#[inline] fn is_valid_cap_letter(b: &u8) -> bool { match *b { b'0'..=b'9' | b'a'..=b'z' | b'A'..=b'Z' | b'_' => true, diff -Nru rust-grep-matcher-0.1.6/src/lib.rs rust-grep-matcher-0.1.7/src/lib.rs --- rust-grep-matcher-0.1.6/src/lib.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-grep-matcher-0.1.7/src/lib.rs 2006-07-24 01:21:28.000000000 +0000 @@ -6,12 +6,10 @@ [`grep-searcher`](https://docs.rs/grep-searcher) crate. -The primary thing provided by this crate is the -[`Matcher`](trait.Matcher.html) -trait. The trait defines an abstract interface for text search. It is robust -enough to support everything from basic substring search all the way to -arbitrarily complex regular expression implementations without sacrificing -performance. +The primary thing provided by this crate is the [`Matcher`] trait. The trait +defines an abstract interface for text search. It is robust enough to support +everything from basic substring search all the way to arbitrarily complex +regular expression implementations without sacrificing performance. A key design decision made in this crate is the use of *internal iteration*, or otherwise known as the "push" model of searching. In this paradigm, @@ -38,11 +36,6 @@ #![deny(missing_docs)] -use std::fmt; -use std::io; -use std::ops; -use std::u64; - use crate::interpolate::interpolate; mod interpolate; @@ -162,7 +155,7 @@ } } -impl ops::Index for [u8] { +impl std::ops::Index for [u8] { type Output = [u8]; #[inline] @@ -171,14 +164,14 @@ } } -impl ops::IndexMut for [u8] { +impl std::ops::IndexMut for [u8] { #[inline] fn index_mut(&mut self, index: Match) -> &mut [u8] { &mut self[index.start..index.end] } } -impl ops::Index for str { +impl std::ops::Index for str { type Output = str; #[inline] @@ -204,11 +197,7 @@ #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] enum LineTerminatorImp { /// Any single byte representing a line terminator. - /// - /// We represent this as an array so we can safely convert it to a slice - /// for convenient access. At some point, we can use `std::slice::from_ref` - /// instead. - Byte([u8; 1]), + Byte(u8), /// A line terminator represented by `\r\n`. /// /// When this option is used, consumers may generally treat a lone `\n` as @@ -220,7 +209,7 @@ /// Return a new single-byte line terminator. Any byte is valid. #[inline] pub fn byte(byte: u8) -> LineTerminator { - LineTerminator(LineTerminatorImp::Byte([byte])) + LineTerminator(LineTerminatorImp::Byte(byte)) } /// Return a new line terminator represented by `\r\n`. @@ -246,7 +235,7 @@ #[inline] pub fn as_byte(&self) -> u8 { match self.0 { - LineTerminatorImp::Byte(array) => array[0], + LineTerminatorImp::Byte(byte) => byte, LineTerminatorImp::CRLF => b'\n', } } @@ -260,7 +249,7 @@ #[inline] pub fn as_bytes(&self) -> &[u8] { match self.0 { - LineTerminatorImp::Byte(ref array) => array, + LineTerminatorImp::Byte(ref byte) => std::slice::from_ref(byte), LineTerminatorImp::CRLF => &[b'\r', b'\n'], } } @@ -301,10 +290,10 @@ #[derive(Clone, Copy)] struct BitSet([u64; 4]); -impl fmt::Debug for BitSet { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { +impl std::fmt::Debug for BitSet { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let mut fmtd = f.debug_set(); - for b in (0..256).map(|b| b as u8) { + for b in 0..=255 { if ByteSet(*self).contains(b) { fmtd.entry(&b); } @@ -315,12 +304,14 @@ impl ByteSet { /// Create an empty set of bytes. + #[inline] pub fn empty() -> ByteSet { ByteSet(BitSet([0; 4])) } /// Create a full set of bytes such that every possible byte is in the set /// returned. + #[inline] pub fn full() -> ByteSet { ByteSet(BitSet([u64::MAX; 4])) } @@ -328,15 +319,17 @@ /// Add a byte to this set. /// /// If the given byte already belongs to this set, then this is a no-op. + #[inline] pub fn add(&mut self, byte: u8) { let bucket = byte / 64; let bit = byte % 64; - (self.0).0[bucket as usize] |= 1 << bit; + (self.0).0[usize::from(bucket)] |= 1 << bit; } /// Add an inclusive range of bytes. + #[inline] pub fn add_all(&mut self, start: u8, end: u8) { - for b in (start as u64..end as u64 + 1).map(|b| b as u8) { + for b in start..=end { self.add(b); } } @@ -344,24 +337,27 @@ /// Remove a byte from this set. /// /// If the given byte is not in this set, then this is a no-op. + #[inline] pub fn remove(&mut self, byte: u8) { let bucket = byte / 64; let bit = byte % 64; - (self.0).0[bucket as usize] &= !(1 << bit); + (self.0).0[usize::from(bucket)] &= !(1 << bit); } /// Remove an inclusive range of bytes. + #[inline] pub fn remove_all(&mut self, start: u8, end: u8) { - for b in (start as u64..end as u64 + 1).map(|b| b as u8) { + for b in start..=end { self.remove(b); } } /// Return true if and only if the given byte is in this set. + #[inline] pub fn contains(&self, byte: u8) -> bool { let bucket = byte / 64; let bit = byte % 64; - (self.0).0[bucket as usize] & (1 << bit) > 0 + (self.0).0[usize::from(bucket)] & (1 << bit) > 0 } } @@ -398,6 +394,7 @@ /// /// Note that capturing groups that have non-zero length but otherwise /// contain no matching groups are *not* empty. + #[inline] fn is_empty(&self) -> bool { self.len() == 0 } @@ -431,6 +428,7 @@ /// the given `haystack`. Generally, this means that `haystack` should be /// the same slice that was searched to get the current capture group /// matches. + #[inline] fn interpolate( &self, name_to_index: F, @@ -462,15 +460,19 @@ impl NoCaptures { /// Create an empty set of capturing groups. + #[inline] pub fn new() -> NoCaptures { NoCaptures(()) } } impl Captures for NoCaptures { + #[inline] fn len(&self) -> usize { 0 } + + #[inline] fn get(&self, _: usize) -> Option { None } @@ -478,27 +480,27 @@ /// NoError provides an error type for matchers that never produce errors. /// -/// This error type implements the `std::error::Error` and `fmt::Display` +/// This error type implements the `std::error::Error` and `std::fmt::Display` /// traits for use in matcher implementations that can never produce errors. /// -/// The `fmt::Debug` and `fmt::Display` impls for this type panics. +/// The `std::fmt::Debug` and `std::fmt::Display` impls for this type panics. #[derive(Debug, Eq, PartialEq)] pub struct NoError(()); -impl ::std::error::Error for NoError { +impl std::error::Error for NoError { fn description(&self) -> &str { "no error" } } -impl fmt::Display for NoError { - fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { +impl std::fmt::Display for NoError { + fn fmt(&self, _: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { panic!("BUG for NoError: an impossible error occurred") } } -impl From for io::Error { - fn from(_: NoError) -> io::Error { +impl From for std::io::Error { + fn from(_: NoError) -> std::io::Error { panic!("BUG for NoError: an impossible error occurred") } } @@ -522,13 +524,11 @@ /// A matcher defines an interface for regular expression implementations. /// /// While this trait is large, there are only two required methods that -/// implementors must provide: `find_at` and `new_captures`. If captures -/// aren't supported by your implementation, then `new_captures` can be -/// implemented with -/// [`NoCaptures`](struct.NoCaptures.html). If your implementation does support -/// capture groups, then you should also implement the other capture related -/// methods, as dictated by the documentation. Crucially, this includes -/// `captures_at`. +/// implementors must provide: `find_at` and `new_captures`. If captures aren't +/// supported by your implementation, then `new_captures` can be implemented +/// with [`NoCaptures`]. If your implementation does support capture groups, +/// then you should also implement the other capture related methods, as +/// dictated by the documentation. Crucially, this includes `captures_at`. /// /// The rest of the methods on this trait provide default implementations on /// top of `find_at` and `new_captures`. It is not uncommon for implementations @@ -547,7 +547,7 @@ /// use the `NoError` type in this crate. In the future, when the "never" /// (spelled `!`) type is stabilized, then it should probably be used /// instead. - type Error: fmt::Display; + type Error: std::fmt::Display; /// Returns the start and end byte range of the first match in `haystack` /// after `at`, where the byte offsets are relative to that start of @@ -584,6 +584,7 @@ /// /// By default, capturing groups are not supported, so this always /// returns 0. + #[inline] fn capture_count(&self) -> usize { 0 } @@ -597,6 +598,7 @@ /// /// By default, capturing groups are not supported, so this always returns /// `None`. + #[inline] fn capture_index(&self, _name: &str) -> Option { None } @@ -606,6 +608,7 @@ /// /// The text encoding of `haystack` is not strictly specified. Matchers are /// advised to assume UTF-8, or at worst, some ASCII compatible encoding. + #[inline] fn find(&self, haystack: &[u8]) -> Result, Self::Error> { self.find_at(haystack, 0) } @@ -613,6 +616,7 @@ /// Executes the given function over successive non-overlapping matches /// in `haystack`. If no match exists, then the given function is never /// called. If the function returns `false`, then iteration stops. + #[inline] fn find_iter( &self, haystack: &[u8], @@ -631,6 +635,7 @@ /// The significance of the starting point is that it takes the surrounding /// context into consideration. For example, the `\A` anchor can only /// match when `at == 0`. + #[inline] fn find_iter_at( &self, haystack: &[u8], @@ -651,6 +656,7 @@ /// the error is yielded. If an error occurs while executing the search, /// then it is converted to /// `E`. + #[inline] fn try_find_iter( &self, haystack: &[u8], @@ -673,6 +679,7 @@ /// The significance of the starting point is that it takes the surrounding /// context into consideration. For example, the `\A` anchor can only /// match when `at == 0`. + #[inline] fn try_find_iter_at( &self, haystack: &[u8], @@ -720,6 +727,7 @@ /// /// The text encoding of `haystack` is not strictly specified. Matchers are /// advised to assume UTF-8, or at worst, some ASCII compatible encoding. + #[inline] fn captures( &self, haystack: &[u8], @@ -732,6 +740,7 @@ /// in `haystack` with capture groups extracted from each match. If no /// match exists, then the given function is never called. If the function /// returns `false`, then iteration stops. + #[inline] fn captures_iter( &self, haystack: &[u8], @@ -752,6 +761,7 @@ /// The significance of the starting point is that it takes the surrounding /// context into consideration. For example, the `\A` anchor can only /// match when `at == 0`. + #[inline] fn captures_iter_at( &self, haystack: &[u8], @@ -773,6 +783,7 @@ /// returns an error then iteration stops and the error is yielded. If /// an error occurs while executing the search, then it is converted to /// `E`. + #[inline] fn try_captures_iter( &self, haystack: &[u8], @@ -796,6 +807,7 @@ /// The significance of the starting point is that it takes the surrounding /// context into consideration. For example, the `\A` anchor can only /// match when `at == 0`. + #[inline] fn try_captures_iter_at( &self, haystack: &[u8], @@ -862,6 +874,7 @@ /// Note that if implementors seek to support capturing groups, then they /// should implement this method. Other methods that match based on /// captures will then work automatically. + #[inline] fn captures_at( &self, _haystack: &[u8], @@ -876,6 +889,7 @@ /// a handle to the `dst` buffer provided. /// /// If the given `append` function returns `false`, then replacement stops. + #[inline] fn replace( &self, haystack: &[u8], @@ -899,6 +913,7 @@ /// `append` with the matching capture groups. /// /// If the given `append` function returns `false`, then replacement stops. + #[inline] fn replace_with_captures( &self, haystack: &[u8], @@ -920,6 +935,7 @@ /// The significance of the starting point is that it takes the surrounding /// context into consideration. For example, the `\A` anchor can only /// match when `at == 0`. + #[inline] fn replace_with_captures_at( &self, haystack: &[u8], @@ -945,6 +961,7 @@ /// Returns true if and only if the matcher matches the given haystack. /// /// By default, this method is implemented by calling `shortest_match`. + #[inline] fn is_match(&self, haystack: &[u8]) -> Result { self.is_match_at(haystack, 0) } @@ -957,6 +974,7 @@ /// The significance of the starting point is that it takes the surrounding /// context into consideration. For example, the `\A` anchor can only /// match when `at == 0`. + #[inline] fn is_match_at( &self, haystack: &[u8], @@ -979,6 +997,7 @@ /// a faster implementation of this than what `find` does. /// /// By default, this method is implemented by calling `find`. + #[inline] fn shortest_match( &self, haystack: &[u8], @@ -1004,6 +1023,7 @@ /// The significance of the starting point is that it takes the surrounding /// context into consideration. For example, the `\A` anchor can only /// match when `at == 0`. + #[inline] fn shortest_match_at( &self, haystack: &[u8], @@ -1032,6 +1052,7 @@ /// exists with that byte. /// /// By default, this returns `None`. + #[inline] fn non_matching_bytes(&self) -> Option<&ByteSet> { None } @@ -1048,6 +1069,7 @@ /// `CRLF`. /// /// By default, this returns `None`. + #[inline] fn line_terminator(&self) -> Option { None } @@ -1090,6 +1112,7 @@ /// Note that while this method may report false positives, it must never /// report false negatives. That is, it can never skip over lines that /// contain a match. + #[inline] fn find_candidate_line( &self, haystack: &[u8], @@ -1102,6 +1125,7 @@ type Captures = M::Captures; type Error = M::Error; + #[inline] fn find_at( &self, haystack: &[u8], @@ -1110,10 +1134,12 @@ (*self).find_at(haystack, at) } + #[inline] fn new_captures(&self) -> Result { (*self).new_captures() } + #[inline] fn captures_at( &self, haystack: &[u8], @@ -1123,18 +1149,22 @@ (*self).captures_at(haystack, at, caps) } + #[inline] fn capture_index(&self, name: &str) -> Option { (*self).capture_index(name) } + #[inline] fn capture_count(&self) -> usize { (*self).capture_count() } + #[inline] fn find(&self, haystack: &[u8]) -> Result, Self::Error> { (*self).find(haystack) } + #[inline] fn find_iter( &self, haystack: &[u8], @@ -1146,6 +1176,7 @@ (*self).find_iter(haystack, matched) } + #[inline] fn find_iter_at( &self, haystack: &[u8], @@ -1158,6 +1189,7 @@ (*self).find_iter_at(haystack, at, matched) } + #[inline] fn try_find_iter( &self, haystack: &[u8], @@ -1169,6 +1201,7 @@ (*self).try_find_iter(haystack, matched) } + #[inline] fn try_find_iter_at( &self, haystack: &[u8], @@ -1181,6 +1214,7 @@ (*self).try_find_iter_at(haystack, at, matched) } + #[inline] fn captures( &self, haystack: &[u8], @@ -1189,6 +1223,7 @@ (*self).captures(haystack, caps) } + #[inline] fn captures_iter( &self, haystack: &[u8], @@ -1201,6 +1236,7 @@ (*self).captures_iter(haystack, caps, matched) } + #[inline] fn captures_iter_at( &self, haystack: &[u8], @@ -1214,6 +1250,7 @@ (*self).captures_iter_at(haystack, at, caps, matched) } + #[inline] fn try_captures_iter( &self, haystack: &[u8], @@ -1226,6 +1263,7 @@ (*self).try_captures_iter(haystack, caps, matched) } + #[inline] fn try_captures_iter_at( &self, haystack: &[u8], @@ -1239,6 +1277,7 @@ (*self).try_captures_iter_at(haystack, at, caps, matched) } + #[inline] fn replace( &self, haystack: &[u8], @@ -1251,6 +1290,7 @@ (*self).replace(haystack, dst, append) } + #[inline] fn replace_with_captures( &self, haystack: &[u8], @@ -1264,6 +1304,7 @@ (*self).replace_with_captures(haystack, caps, dst, append) } + #[inline] fn replace_with_captures_at( &self, haystack: &[u8], @@ -1278,10 +1319,12 @@ (*self).replace_with_captures_at(haystack, at, caps, dst, append) } + #[inline] fn is_match(&self, haystack: &[u8]) -> Result { (*self).is_match(haystack) } + #[inline] fn is_match_at( &self, haystack: &[u8], @@ -1290,6 +1333,7 @@ (*self).is_match_at(haystack, at) } + #[inline] fn shortest_match( &self, haystack: &[u8], @@ -1297,6 +1341,7 @@ (*self).shortest_match(haystack) } + #[inline] fn shortest_match_at( &self, haystack: &[u8], @@ -1305,14 +1350,17 @@ (*self).shortest_match_at(haystack, at) } + #[inline] fn non_matching_bytes(&self) -> Option<&ByteSet> { (*self).non_matching_bytes() } + #[inline] fn line_terminator(&self) -> Option { (*self).line_terminator() } + #[inline] fn find_candidate_line( &self, haystack: &[u8], diff -Nru rust-grep-matcher-0.1.6/tests/test_matcher.rs rust-grep-matcher-0.1.7/tests/test_matcher.rs --- rust-grep-matcher-0.1.6/tests/test_matcher.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-grep-matcher-0.1.7/tests/test_matcher.rs 2006-07-24 01:21:28.000000000 +0000 @@ -1,5 +1,7 @@ -use grep_matcher::{Captures, Match, Matcher}; -use regex::bytes::Regex; +use { + grep_matcher::{Captures, Match, Matcher}, + regex::bytes::Regex, +}; use crate::util::{RegexMatcher, RegexMatcherNoCaps}; diff -Nru rust-grep-matcher-0.1.6/tests/util.rs rust-grep-matcher-0.1.7/tests/util.rs --- rust-grep-matcher-0.1.6/tests/util.rs 2006-07-24 01:21:28.000000000 +0000 +++ rust-grep-matcher-0.1.7/tests/util.rs 2006-07-24 01:21:28.000000000 +0000 @@ -1,28 +1,29 @@ use std::collections::HashMap; -use std::result; -use grep_matcher::{Captures, Match, Matcher, NoCaptures, NoError}; -use regex::bytes::{CaptureLocations, Regex}; +use { + grep_matcher::{Captures, Match, Matcher, NoCaptures, NoError}, + regex::bytes::{CaptureLocations, Regex}, +}; #[derive(Debug)] -pub struct RegexMatcher { +pub(crate) struct RegexMatcher { pub re: Regex, pub names: HashMap, } impl RegexMatcher { - pub fn new(re: Regex) -> RegexMatcher { + pub(crate) fn new(re: Regex) -> RegexMatcher { let mut names = HashMap::new(); for (i, optional_name) in re.capture_names().enumerate() { if let Some(name) = optional_name { names.insert(name.to_string(), i); } } - RegexMatcher { re: re, names: names } + RegexMatcher { re, names } } } -type Result = result::Result; +type Result = std::result::Result; impl Matcher for RegexMatcher { type Captures = RegexCaptures; @@ -63,7 +64,7 @@ } #[derive(Debug)] -pub struct RegexMatcherNoCaps(pub Regex); +pub(crate) struct RegexMatcherNoCaps(pub(crate) Regex); impl Matcher for RegexMatcherNoCaps { type Captures = NoCaptures; @@ -82,7 +83,7 @@ } #[derive(Clone, Debug)] -pub struct RegexCaptures(CaptureLocations); +pub(crate) struct RegexCaptures(CaptureLocations); impl Captures for RegexCaptures { fn len(&self) -> usize {