Track call arguments in a single list (#5125)

* Initial implementation of ordered call args

* Run cargo fmt

* Fix some clippy lints

* Add positional len and nth

* Cargo fmt

* Remove more old nth calls

* Good ole rustfmt

* Add named len

Co-authored-by: Hristo Filaretov <h.filaretov@protonmail.com>
This commit is contained in:
Hristo Filaretov
2022-04-09 04:55:02 +02:00
committed by GitHub
parent 3bac480ca0
commit 683b912263
25 changed files with 263 additions and 190 deletions

View File

@ -57,13 +57,18 @@ impl Command for Mkdir {
}
for (i, dir) in directories.enumerate() {
let span = call.positional[i].span;
let span = call
.positional_nth(i)
.expect("already checked through directories")
.span;
let dir_res = std::fs::create_dir_all(&dir);
if let Err(reason) = dir_res {
return Err(ShellError::CreateNotPossible(
format!("failed to create directory: {}", reason),
call.positional[i].span,
call.positional_nth(i)
.expect("already checked through directories")
.span,
));
}