Skip to content

Instantly share code, notes, and snippets.

@qbit
Created April 4, 2022 15:27
Show Gist options
  • Save qbit/9e51d8762a398fcbb628fa526ccb22e4 to your computer and use it in GitHub Desktop.
Save qbit/9e51d8762a398fcbb628fa526ccb22e4 to your computer and use it in GitHub Desktop.

Things I dislike about Rust

  • Things I strongly dislike:
    • The dividing line between crate and stdlib leans way too far to the crate side of things.
      • Remote dependencies are needed to do virtually everything. There isn’t even a rand package in the standard library.
    • Implicit returns.
      • Semicolon on return changes behavior:

        fn add1(a: i32, b: i32) -> i32 {
           a + b
        }
        
        fn add2(a: i32, b:i32) -> i32 {
            a + b;
        }
        
        fn TypeOf<T>(_: &T) {
            println!("{}", std::any::type_name::<T>())
        }
        
        fn main() {
            let a = add1(1, 2);
            let b = add2(1, 2);
            
            TypeOf(&a);
            TypeOf(&b);
        }
        • At least the compiler errors on this though.
    • Overly complex - seeming to solve self made problems:

      ``` rust
      let b: i32 = 20;
      let c = 30i32;
      let d = 30_i32
      ```
      
    • Crate breakage across minor releases of rust.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment