Skip to content

Commit 215bf21

Browse files
Cleanup.
1 parent b2b3e44 commit 215bf21

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

src/parser/regex.rs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub struct RegexProcessor {
2121
impl RegexProcessor {
2222
pub fn new(command_line_args: &CommandLineArgs) -> anyhow::Result<Arc<Self>> {
2323
let auto_regex = AutoCommandLineArgsRegex::new(command_line_args);
24-
debug!("auto_regex = {:?}", auto_regex);
2524

2625
let command_line_regex = match (auto_regex, &command_line_args.regex) {
2726
(Some(auto_regex), _) => Some(CommandLineRegex::new(&auto_regex.0)?),
@@ -47,14 +46,14 @@ impl RegexProcessor {
4746
};
4847

4948
let mut results: Vec<String> = Vec::with_capacity(arguments.len());
50-
let mut found_match = false;
49+
let mut found_input_data_match = false;
5150
let mut modified_arguments = false;
5251

5352
for argument in arguments {
5453
match command_line_regex.expand(argument.into(), input_data) {
5554
Some(result) => {
5655
results.push(result.argument.to_string());
57-
found_match = true;
56+
found_input_data_match = true;
5857
modified_arguments = modified_arguments || result.modified_argument;
5958
}
6059
None => {
@@ -63,12 +62,7 @@ impl RegexProcessor {
6362
};
6463
}
6564

66-
debug!(
67-
"in apply_regex_to_arguments arguments = {:?} input_data = {:?} found_match = {} results = {:?}",
68-
arguments, input_data, found_match,results
69-
);
70-
71-
if !found_match {
65+
if !found_input_data_match {
7266
warn!("regex did not match input data: {}", input_data);
7367
None
7468
} else {
@@ -123,11 +117,6 @@ impl CommandLineRegex {
123117
fn expand<'a>(&self, argument: Cow<'a, str>, input_data: &str) -> Option<ExpandResult<'a>> {
124118
let captures = self.regex.captures(input_data)?;
125119

126-
debug!(
127-
"in expand argument = {:?} input_data = {:?} captures = {:?}",
128-
argument, input_data, captures
129-
);
130-
131120
let mut argument = argument;
132121
let mut modified_argument = false;
133122

@@ -154,14 +143,10 @@ impl CommandLineRegex {
154143
}
155144
}
156145

157-
let result = ExpandResult {
146+
Some(ExpandResult {
158147
argument,
159148
modified_argument,
160-
};
161-
162-
debug!("expand returning result = {:?}", result);
163-
164-
Some(result)
149+
})
165150
}
166151
}
167152

0 commit comments

Comments
 (0)