pub fn convert(number: &[u32], from_base: u32, to_base: u32) -> Result<Vec<u32>, ()> {
    if from_base < 2 || to_base < 2 {
        return Err(());
    }

    if number.iter().any(|&x| x >= from_base) {
        return Err(());
    }

    let limit = number.iter().fold(0, |acc, &x| acc * from_base + x);
    let mut r = limit;

    let mut result = (0..)
        .take_while(|&x| limit >= to_base.pow(x as u32))
        .map(|_| {
            let d = r % to_base;
            r /= to_base;
            d
        })
        .collect::<Vec<_>>();

    result.reverse();

    Ok(result)
}

///
/// Convert a number between two bases.
///
/// A number is any slice of digits.
/// A digit is any unsigned integer (e.g. u8, u16, u32, u64, or usize).
/// Bases are specified as unsigned integers.
///
/// Return an `Err(.)` if the conversion is impossible.
/// The tests do not test for specific values inside the `Err(.)`.
///
///
/// You are allowed to change the function signature as long as all test still pass.
///
///
/// Example:
/// Input
///   number: &[4, 2]
///   from_base: 10
///   to_base: 2
/// Result
///   Ok(vec![1, 0, 1, 0, 1, 0])
///
/// The example corresponds to converting the number 42 from decimal
/// which is equivalent to 101010 in binary.
///
///
/// Notes:
///  * The empty slice ( "[]" ) is equal to the number 0.
///  * Never output leading 0 digits. However, your function must be able to
///     process input with leading 0 digits.
///
#[allow(unused_variables)]
pub fn convert(number: &[u32], from_base: u32, to_base: u32) -> Result<Vec<u32>, ()> {
    if number.into_iter().any(|&x| x >= from_base) {
        return Err(());
    }

    if from_base < 2 || to_base < 2 {
        return Err(());
    }

    let mut r = number.into_iter().fold(0, |acc, &x| acc * from_base + x);

    let mut result = (0..)
        .take_while(move |&x| r >= to_base.pow(x as u32))
        .map(|x| {
            let d = r % to_base;
            r /= to_base;
            d
        })
        .collect::<Vec<_>>();

    result.reverse();

    Ok(result)
}

--- 
+++ 
@@ -1,18 +1,49 @@
+///
+/// Convert a number between two bases.
+///
+/// A number is any slice of digits.
+/// A digit is any unsigned integer (e.g. u8, u16, u32, u64, or usize).
+/// Bases are specified as unsigned integers.
+///
+/// Return an `Err(.)` if the conversion is impossible.
+/// The tests do not test for specific values inside the `Err(.)`.
+///
+///
+/// You are allowed to change the function signature as long as all test still pass.
+///
+///
+/// Example:
+/// Input
+///   number: &[4, 2]
+///   from_base: 10
+///   to_base: 2
+/// Result
+///   Ok(vec![1, 0, 1, 0, 1, 0])
+///
+/// The example corresponds to converting the number 42 from decimal
+/// which is equivalent to 101010 in binary.
+///
+///
+/// Notes:
+///  * The empty slice ( "[]" ) is equal to the number 0.
+///  * Never output leading 0 digits. However, your function must be able to
+///     process input with leading 0 digits.
+///
+#[allow(unused_variables)]
 pub fn convert(number: &[u32], from_base: u32, to_base: u32) -> Result<Vec<u32>, ()> {
+    if number.into_iter().any(|&x| x >= from_base) {
+        return Err(());
+    }
+
     if from_base < 2 || to_base < 2 {
         return Err(());
     }
 
-    if number.iter().any(|&x| x >= from_base) {
-        return Err(());
-    }
-
-    let limit = number.iter().fold(0, |acc, &x| acc * from_base + x);
-    let mut r = limit;
+    let mut r = number.into_iter().fold(0, |acc, &x| acc * from_base + x);
 
     let mut result = (0..)
-        .take_while(|&x| limit >= to_base.pow(x as u32))
-        .map(|_| {
+        .take_while(move |&x| r >= to_base.pow(x as u32))
+        .map(|x| {
             let d = r % to_base;
             r /= to_base;
             d
Clean up rust code for all-your-base

It looks better now
