Skip to content

Commit

Permalink
Clippy: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
dandavison committed Dec 21, 2021
1 parent 94d84d1 commit 1d265f9
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/handlers/grep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,24 +288,24 @@ fn make_output_config() -> GrepOutputConfig {
}

enum GrepLineRegex {
FilePathWithFileExtensionAndLineNumber,
FilePathWithFileExtension,
FilePathWithoutSeparatorCharacters,
WithFileExtensionAndLineNumber,
WithFileExtension,
WithoutSeparatorCharacters,
}

lazy_static! {
static ref GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION_AND_LINE_NUMBER: Regex =
make_grep_line_regex(GrepLineRegex::FilePathWithFileExtensionAndLineNumber);
make_grep_line_regex(GrepLineRegex::WithFileExtensionAndLineNumber);
}

lazy_static! {
static ref GREP_LINE_REGEX_ASSUMING_FILE_EXTENSION: Regex =
make_grep_line_regex(GrepLineRegex::FilePathWithFileExtension);
make_grep_line_regex(GrepLineRegex::WithFileExtension);
}

lazy_static! {
static ref GREP_LINE_REGEX_ASSUMING_NO_INTERNAL_SEPARATOR_CHARS: Regex =
make_grep_line_regex(GrepLineRegex::FilePathWithoutSeparatorCharacters);
make_grep_line_regex(GrepLineRegex::WithoutSeparatorCharacters);
}

// See tests for example grep lines
Expand Down Expand Up @@ -334,8 +334,7 @@ fn make_grep_line_regex(regex_variant: GrepLineRegex) -> Regex {
// Make-7-file-7-xxx

let file_path = match regex_variant {
GrepLineRegex::FilePathWithFileExtensionAndLineNumber
| GrepLineRegex::FilePathWithFileExtension => {
GrepLineRegex::WithFileExtensionAndLineNumber | GrepLineRegex::WithFileExtension => {
r"
( # 1. file name (colons not allowed)
[^:|\ ] # try to be strict about what a file path can start with
Expand All @@ -344,7 +343,7 @@ fn make_grep_line_regex(regex_variant: GrepLineRegex) -> Regex {
)
"
}
GrepLineRegex::FilePathWithoutSeparatorCharacters => {
GrepLineRegex::WithoutSeparatorCharacters => {
r"
( # 1. file name (colons not allowed)
[^:|\ =-] # try to be strict about what a file path can start with
Expand All @@ -356,7 +355,7 @@ fn make_grep_line_regex(regex_variant: GrepLineRegex) -> Regex {
};

let separator = match regex_variant {
GrepLineRegex::FilePathWithFileExtensionAndLineNumber => {
GrepLineRegex::WithFileExtensionAndLineNumber => {
r#"
(?:
(
Expand Down

0 comments on commit 1d265f9

Please sign in to comment.