From a78fb454973a2546bde42f6d236448fe6d36ab64 Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Mon, 5 Apr 2021 16:52:10 -0700 Subject: [PATCH] Fix use of not-quite-stabilized API, and explain what the line did anyway --- xtask/src/submodules.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xtask/src/submodules.rs b/xtask/src/submodules.rs index ab06f43df..1f369d38e 100644 --- a/xtask/src/submodules.rs +++ b/xtask/src/submodules.rs @@ -144,7 +144,9 @@ fn all_submodules() -> Result> { let mut pb = vec![]; for kv in out.stdout.split(|n| *n == 0).filter(|v| !v.is_empty()) { if let Ok(v) = std::str::from_utf8(kv) { - if let Some((_, path)) = v.split_once('\n') { + // `v` is formatted like "{name}\n{path}", so discard everything up + // to (and including) the newline. + if let Some(path) = v.find('\n').map(|p| &v[(p + 1)..]) { pb.push(path.into()); } else { eprintln!(