• We'll have to give it a week, as the system grants the kata author some time to respond before others can do so. Given that they haven't logged on for more than a month, it can likely be approved after next week.

    Have a great day!

  • Hello!

    I think you're absolutely right. Your proposed enhancements make the translation far easier to understand and align much more closely with idiomatic Rust principles. Thank you for taking the time to add and propose them.

  • Hey, another Rust translator!

    It's good to see the removal of the default comments that are part of the tests.

    I've added the below to the fork, but a few comments on the translation:

    fn nth_fibonacci(n: u64) -> u64 {
        return n;

    It's more idiomatic in this case to only return n and drop the return, considering it is implicit in Rust.

    Regarding idiomatic Rust on Codewars, here are some tips that I try to be mindful of when translating:

    In general while translating on Codewars, make sure to add random tests. For this you can use the rand crate in Rust.

    Typically what is used are 100 iterations at a minimum, excluding kata that have strict performance requirements. You might come across old kata that do not have random tests, but ideally these should also have random tests.

    I've also made use of the custom message for an assertion to indicate what went wrong.

    fn test_1st_fibonacci() {
        assert_eq!(nth_fibonacci(1), 0, "1-st fibonacci");

    This is especially useful for users when debugging random tests.

    let actual = nth_fibonacci(n);
    let expect = nth_fibonacci_solution(n);
    assert_eq!(actual, expect, "Expected {} for nth_fibonacci({})", expect, n);

    We can also change the type to a u32 as the 39-th fibonacci number doesn't overflow it.

  • Maybe that's why it says Puzzles in the tags list? I think the kata's author wanted you to figure that out.

  • This comment is hidden because it contains spoiler information about the solution