Guest User

Untitled

a guest
Feb 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. fn main() {
  2. import_path_to_string(&[1]);
  3. import_path_to_string(&[]);
  4. }
  5.  
  6. fn import_path_to_string(names: &[u32]) {
  7. let pos = names.iter().position(|&x| x != 1);
  8. let global = !names.is_empty() && names[0] == 1;
  9. if let Some(pos) = pos {
  10. let _dead = if global { &names[1..pos + 1] } else { &names[..pos + 1] };
  11. } else {
  12. let names = if global { &names[1..] } else { names };
  13. if !names.is_empty() {
  14. panic!("{}", names.len());
  15. }
  16. }
  17. }
Add Comment
Please, Sign In to add comment