First larger code - review appreciated

Hi, with the help of my friend, I wrote my first larger piece of code in Rust - the implementation of the RTDE protocol used in communication with Universal Robots robots. I'm sure I did a lot of beginner mistakes, so if someone could spend some time reviewing it, I'll appreciate it.

It's available as a Github PR for review at Implementation for review. by mikolajz · Pull Request #1 · mikolajz/ur_rtde · GitHub .

The code is relatively large (2.5k lines), but is divided into three layers as described in the README.md, so can be reviewed one after another. The README.md also contains pointers to things I know are missing (like good error handling), but I'm sure there is quite a few I don't know :slight_smile: .

1 Like

It would be great if "cargo clippy" warnings could be fixed

2 Likes

Nice tool. I've fixed the warning (except for one in lib.rs where I'm not sure how to fix it - left a comment with a note)

You can also format code by running "cargo fmt" :slight_smile:

Reformatted

I made a couple comments on GitHub. It's too much code for me to digest in one go, but I noticed that most of my comments (e.g. about stuttering module names, eta-reducible unnecessary closures, or matching on booleans) could have been caught by Clippy had you used a less lenient setting. I suggest you to turn on the following lints and then re-run Clippy:

#![deny(clippy::correctness, clippy::complexity, clippy::style,
        clippy::perf, clippy::cargo,
        clippy::create_dir, clippy::else_if_without_else, clippy::exit,
        clippy::filetype_is_file, clippy::float_cmp_const, clippy::get_unwrap,
        clippy::inline_asm_x86_att_syntax, clippy::let_underscore_must_use,
        clippy::lossy_float_literal, clippy::map_err_ignore,
        clippy::mem_forget, clippy::missing_docs_in_private_items,
        clippy::multiple_inherent_impl, clippy::panic_in_result_fn,
        clippy::rc_buffer, clippy::rest_pat_in_fully_bound_structs,
        clippy::shadow_reuse,
        clippy::shadow_same, clippy::str_to_string, clippy::string_add,
        clippy::string_to_string, clippy::unneeded_field_pattern,
        clippy::unwrap_in_result, clippy::unwrap_used,
        clippy::verbose_file_reads, clippy::wildcard_enum_match_arm)]
#![warn(clippy::dbg_macro, clippy::decimal_literal_representation,
        clippy::panic, clippy::print_stderr, clippy::print_stdout,
        clippy::todo, clippy::unimplemented, clippy::use_debug)]
1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.