Ad
  • Custom User Avatar

    This is a bad suggestion as this question is aimed at functional programming with algebraic datatypes. In Rust the actual return types for this function are Result::Ok(u32) and Result::Err(String). Result is a useful monoid that makes error handling super simple when you combine it with pattern matching.

  • Custom User Avatar

    Suggestion: If no divisors are found, return an empty array, just to keep type consistency in the returned value! ☺