fn read_input(input: &str) -> (Vec<DiagnosticNumber>, Vec<DiagnosticNumber>, isize) {
    let mut ones = Vec::new();
    let mut zeroes = Vec::new();
    let mut len = 0;
    for line in input.lines() {
        let mut n = 0;
        let bytes = line.as_bytes();
        if len == 0 {
            len = bytes.len() as isize;
        }
        let first = bytes[0];
        n |= (first & 1) as DiagnosticNumber;
        for &c in &bytes[1..] {
            n <<= 1;
            n |= (c & 1) as u16;
        }
        if first & 1 > 0 {
            ones.push(n);
        } else {
            zeroes.push(n);
        }
    }
    if ones.len() >= zeroes.len() {
        (ones, zeroes, len)
    } else {
        (zeroes, ones, len)
    }
}
/// More resilient
// type diagnosticNumber = usize;
More resilient
type diagnosticNumber = usize.
More resilient type diagnosticNumber = usize .
fn read_input(input: &str) -> (Vec<DiagnosticNumber>, Vec<DiagnosticNumber>, isize) {
    let mut ones = Vec::new();
    let mut zeroes = Vec::new();
    let mut len = 0;
    for line in input.lines() {
        let mut n = 0;
        let bytes = line.as_bytes();
        if len == 0 {
            len = bytes.len() as isize;
        }
        let first = bytes[0];
        n |= (first & 1) as DiagnosticNumber;
        for &c in &bytes[1..] {
            n <<= 1;
            n |= (c & 1) as u16;
        }
        if first & 1 > 0 {
            ones.push(n);
        } else {
            zeroes.push(n);
        }
    }
    if ones.len() >= zeroes.len() {
        (ones, zeroes, len)
    } else {
        (zeroes, ones, len)
    }
}
fn read_input ( input : & str ) -> ( Vec < DiagnosticNumber > , Vec < DiagnosticNumber > , isize ) { let mut ones = Vec :: new ( ) ; let mut zeroes = Vec :: new ( ) ; let mut len = 0 ; for line in input . lines ( ) { let mut n = 0 ; let bytes = line . as_bytes ( ) ; if len == 0 { len = bytes . len ( ) as isize ; } let first = bytes [ 0 ] ; n |= ( first & 1 ) as DiagnosticNumber ; for & c in & bytes [ 1 .. ] { n <<= 1 ; n |= ( c & 1 ) as u16 ; } if first & 1 > 0 { ones . push ( n ) ; } else { zeroes . push ( n ) ; } } if ones . len ( ) >= zeroes . len ( ) { ( ones , zeroes , len ) } else { ( zeroes , ones , len ) } }
More resilient
type diagnosticNumber = usize;
More resilient type diagnosticNumber = usize ;
input
&str