Skip to content

Commit 1d2e8cb

Browse files
committed
directive: split on whitespace to avoid empty words
1 parent 2ad55d3 commit 1d2e8cb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nix-script-directives/src/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ impl Parser {
2525
continue;
2626
}
2727

28-
let without_indicator = line[self.indicator.len()..].trim_start();
29-
let mut words = without_indicator.split(' ');
28+
let line_without_indicator = line[self.indicator.len()..].trim_start();
29+
let mut words = line_without_indicator.split_whitespace();
3030

3131
if let Some(key) = words.next() {
32-
let value = without_indicator[key.len()..].trim_start();
32+
let value = line_without_indicator[key.len()..].trim_start();
3333

3434
if value.is_empty() {
3535
log::warn!("skipping directive \"{}\" because value was empty", key);

0 commit comments

Comments
 (0)