Skip to content

Commit 89a2aa7

Browse files
committed
rustfmt
1 parent c22415f commit 89a2aa7

File tree

1 file changed

+50
-48
lines changed

1 file changed

+50
-48
lines changed

nimbleparse/src/main.rs

Lines changed: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -554,76 +554,78 @@ where
554554
} else {
555555
// If given no input paths, try to find some with `test_files` in the header.
556556
match self.header.get("test_files") {
557-
Some(HeaderValue(_, Value::Setting(Setting::Array(test_globs, _, _)))) => {
558-
for setting in test_globs {
559-
match setting {
560-
Setting::String(s, _) => {
561-
if let Some(yacc_y_path_dir) = self.yacc_y_path.parent() {
562-
let joined = yacc_y_path_dir.join(s);
563-
let joined = joined.as_os_str().to_str();
564-
if let Some(s) = joined {
565-
let mut glob_paths = glob::glob(s)?.peekable();
566-
if glob_paths.peek().is_none() {
567-
return Err(NimbleparseError::Other(
568-
format!("'test_files' glob '{}' matched no paths", s)
557+
Some(HeaderValue(_, Value::Setting(Setting::Array(test_globs, _, _)))) => {
558+
for setting in test_globs {
559+
match setting {
560+
Setting::String(s, _) => {
561+
if let Some(yacc_y_path_dir) = self.yacc_y_path.parent() {
562+
let joined = yacc_y_path_dir.join(s);
563+
let joined = joined.as_os_str().to_str();
564+
if let Some(s) = joined {
565+
let mut glob_paths = glob::glob(s)?.peekable();
566+
if glob_paths.peek().is_none() {
567+
return Err(NimbleparseError::Other(
568+
format!(
569+
"'test_files' glob '{}' matched no paths",
570+
s
571+
)
569572
.to_string()
570573
.into(),
571-
));
572-
}
573-
for path in glob_paths {
574-
let path = path?;
575-
if let Some(ext) = path.extension() {
576-
if let Some(ext) = ext.to_str() {
577-
if ext.starts_with("grm") {
578-
Err(NimbleparseError::Other(
574+
));
575+
}
576+
for path in glob_paths {
577+
let path = path?;
578+
if let Some(ext) = path.extension() {
579+
if let Some(ext) = ext.to_str() {
580+
if ext.starts_with("grm") {
581+
Err(NimbleparseError::Other(
579582
"test_files extensions beginning with `grm` are reserved."
580583
.into(),
581584
))?
585+
}
582586
}
583587
}
588+
paths.push(path);
584589
}
585-
paths.push(path);
586-
}
587-
} else {
588-
return Err(NimbleparseError::Other(
590+
} else {
591+
return Err(NimbleparseError::Other(
589592
format!(
590593
"Unable to convert joined path to str {} with glob '{}'",
591594
self.yacc_y_path.display(),
592595
s
593596
)
594597
.into(),
595598
));
599+
}
600+
} else {
601+
return Err(NimbleparseError::Other(
602+
format!(
603+
"Unable to find parent path for {}",
604+
self.yacc_y_path.display()
605+
)
606+
.into(),
607+
));
596608
}
597-
} else {
609+
}
610+
611+
_ => {
598612
return Err(NimbleparseError::Other(
599-
format!(
600-
"Unable to find parent path for {}",
601-
self.yacc_y_path.display()
602-
)
603-
.into(),
613+
"Expected string values in `test_files`".into(),
604614
));
605615
}
606616
}
607-
608-
_ => {
609-
return Err(NimbleparseError::Other(
610-
"Expected string values in `test_files`".into(),
611-
));
612-
}
613617
}
614618
}
615-
}
616-
Some(_) => {
617-
return Err(NimbleparseError::Other(
618-
"Expected Array of string values in `test_files`".into(),
619-
));
620-
621-
}
622-
None => {
623-
return Err(NimbleparseError::Other(
624-
"Missing <input file> argument".into(),
625-
));
626-
}
619+
Some(_) => {
620+
return Err(NimbleparseError::Other(
621+
"Expected Array of string values in `test_files`".into(),
622+
));
623+
}
624+
None => {
625+
return Err(NimbleparseError::Other(
626+
"Missing <input file> argument".into(),
627+
));
628+
}
627629
}
628630
};
629631
if paths.is_empty() {

0 commit comments

Comments
 (0)