Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- import_path_to_string(&[1]);
- import_path_to_string(&[]);
- }
- fn import_path_to_string(names: &[u32]) {
- let pos = names.iter().position(|&x| x != 1);
- let global = !names.is_empty() && names[0] == 1;
- if let Some(pos) = pos {
- let _dead = if global { &names[1..pos + 1] } else { &names[..pos + 1] };
- } else {
- let names = if global { &names[1..] } else { names };
- if !names.is_empty() {
- panic!("{}", names.len());
- }
- }
- }
Add Comment
Please, Sign In to add comment