mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-11-23 21:54:45 +02:00
style: apply rustfmt
Maybe 2024 changes? Note that we now set `edition = "2024"` explicitly in `rustfmt.toml`. Without this, it seems like it's possible in some cases for rustfmt to run under an older edition's style. Not sure how though.
This commit is contained in:
@@ -341,11 +341,7 @@ impl ConfiguredHIR {
|
||||
|
||||
/// Returns the "end line" anchor for this configuration.
|
||||
fn line_anchor_end(&self) -> hir::Look {
|
||||
if self.config.crlf {
|
||||
hir::Look::EndCRLF
|
||||
} else {
|
||||
hir::Look::EndLF
|
||||
}
|
||||
if self.config.crlf { hir::Look::EndCRLF } else { hir::Look::EndLF }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
use {
|
||||
regex_automata::meta::Regex,
|
||||
regex_syntax::hir::{
|
||||
self,
|
||||
self, Hir,
|
||||
literal::{Literal, Seq},
|
||||
Hir,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -223,11 +222,7 @@ impl Extractor {
|
||||
// extracting prefixes or suffixes.
|
||||
seq = self.cross(seq, self.extract(hir));
|
||||
}
|
||||
if let Some(prev) = prev {
|
||||
prev.choose(seq)
|
||||
} else {
|
||||
seq
|
||||
}
|
||||
if let Some(prev) = prev { prev.choose(seq) } else { seq }
|
||||
}
|
||||
|
||||
/// Extract a sequence from the given alternation.
|
||||
|
||||
@@ -4,8 +4,8 @@ use {
|
||||
NoError,
|
||||
},
|
||||
regex_automata::{
|
||||
meta::Regex, util::captures::Captures as AutomataCaptures, Input,
|
||||
PatternID,
|
||||
Input, PatternID, meta::Regex,
|
||||
util::captures::Captures as AutomataCaptures,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -587,10 +587,12 @@ mod tests {
|
||||
// and the regex could not be modified to remove a line terminator.
|
||||
#[test]
|
||||
fn line_terminator_error() {
|
||||
assert!(RegexMatcherBuilder::new()
|
||||
.line_terminator(Some(b'\n'))
|
||||
.build(r"a\nz")
|
||||
.is_err())
|
||||
assert!(
|
||||
RegexMatcherBuilder::new()
|
||||
.line_terminator(Some(b'\n'))
|
||||
.build(r"a\nz")
|
||||
.is_err()
|
||||
)
|
||||
}
|
||||
|
||||
// Test that enabling CRLF permits `$` to match at the end of a line.
|
||||
|
||||
@@ -122,7 +122,7 @@ fn strip_from_match_ascii(expr: Hir, byte: u8) -> Result<Hir, Error> {
|
||||
mod tests {
|
||||
use regex_syntax::Parser;
|
||||
|
||||
use super::{strip_from_match, LineTerminator};
|
||||
use super::{LineTerminator, strip_from_match};
|
||||
use crate::error::Error;
|
||||
|
||||
fn roundtrip(pattern: &str, byte: u8) -> String {
|
||||
|
||||
Reference in New Issue
Block a user