diff options
author | Jiri Kosina <jkosina@suse.com> | 2025-09-19 17:08:20 +0200 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.com> | 2025-09-19 17:08:36 +0200 |
commit | 71b28769d708f20046fc6f853cf93fb88a8b6e11 (patch) | |
tree | e579afda01909585ed70bb477233b0f4f72dabac /scripts/rustdoc_test_gen.rs | |
parent | 1860b13beca829c056179c63530eebfec9a3efb4 (diff) | |
parent | 02d6eeedbc36d4b309d5518778071a749ef79c4e (diff) |
Merge remote-tracking branch 'origin' into for-6.18/intel-thc-hid
Needed as a basisi for followup support for quicki2c advanced BIOS features.
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'scripts/rustdoc_test_gen.rs')
-rw-r--r-- | scripts/rustdoc_test_gen.rs | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/scripts/rustdoc_test_gen.rs b/scripts/rustdoc_test_gen.rs index 1ca253594d38..abb34ada2508 100644 --- a/scripts/rustdoc_test_gen.rs +++ b/scripts/rustdoc_test_gen.rs @@ -85,24 +85,25 @@ fn find_real_path<'a>(srctree: &Path, valid_paths: &'a mut Vec<PathBuf>, file: & } } - assert!( - valid_paths.len() > 0, - "No path candidates found for `{file}`. This is likely a bug in the build system, or some \ - files went away while compiling." - ); - - if valid_paths.len() > 1 { - eprintln!("Several path candidates found:"); - for path in valid_paths { - eprintln!(" {path:?}"); + match valid_paths.as_slice() { + [] => panic!( + "No path candidates found for `{file}`. This is likely a bug in the build system, or \ + some files went away while compiling." + ), + [valid_path] => valid_path.to_str().unwrap(), + valid_paths => { + use std::fmt::Write; + + let mut candidates = String::new(); + for path in valid_paths { + writeln!(&mut candidates, " {path:?}").unwrap(); + } + panic!( + "Several path candidates found for `{file}`, please resolve the ambiguity by \ + renaming a file or folder. Candidates:\n{candidates}", + ); } - panic!( - "Several path candidates found for `{file}`, please resolve the ambiguity by renaming \ - a file or folder." - ); } - - valid_paths[0].to_str().unwrap() } fn main() { |