by OtomotO · 2y ago · 0 comments
How I hate it, that every second function call can break my program when it's clearly not a "halt the world, it's totally unrecoverable that the user sent us nonsense" type.
Return a Result and get on with your life!
https://github.com/rust-lang/rust-clippy/issues/8184#issuecomment-1003651774
error: indexing may panic
--> src/main.rs:100:57
|
100 | rtmp::header::BasicHeader::ID0 => u32::from(buffer[1]) + 64,
| ^^^^^^^^^
|
= help: consider using `.get(n)` or `.get_mut(n)` instead
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#indexing_slicingI love Rust the language, but the current bazar of little bits of functionality scattered around in the form of a zoo of crates is such a mess compared to, say, Java's class library (I/O, data structures, std. algorthms for searching, sorting etc., arranged in a logically and hierarchially named way).
I'm not against alternative implementations, but I'd rather have one "official" implementation that everyone knows that covers most cases and makes for the idiomatic reading of source code.