builtin read: minor code cleanup

This commit is contained in:
Johannes Altmanninger 2024-03-10 07:12:23 +01:00
parent 62d1720605
commit 2972407b9e

View file

@ -677,11 +677,9 @@ pub fn read(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Opt
break;
};
let text = tok.text_of(&t);
if let Some(out) = unescape_string(text, UnescapeStringStyle::default()) {
parser.set_var_and_fire(argv[var_ptr], opts.place, vec![out]);
} else {
parser.set_var_and_fire(argv[var_ptr], opts.place, vec![text.to_owned()]);
}
let out = unescape_string(text, UnescapeStringStyle::default())
.unwrap_or_else(|| text.to_owned());
parser.set_var_and_fire(argv[var_ptr], opts.place, vec![out]);
var_ptr += 1;
}