General guidelines to review a Rust code

Hello,

What should be the main core guidelines to review code written in Rust for you?
Which questions do you ask the code to pass your personal quality gate?

:slight_smile:

The Rust API Guidelines are mainly for authors of libraries, but there's useful stuff there for all types of Rust code.

1 Like

Clippy lints collect stuff to watch for: Clippy Lints

2 Likes

Luckily with all the checking you get with Rust and clippy ones coding guidelines don't have to be be so huge and difficult to check against.

So what to look at:

It should build without any warnings. From compiler or clippy.

Everything should be subject to cargo fmt.

There should be tests in place for every requirement and more besides

Everything should be documented - rustdoc

I guess a biggie is to grep for "unsafe" and review that thoroughly. Or have a guideline that states "no use of unsafe"

What about checking the licensing on all the dependencies that get dragged in?

Perhaps there should be benchmarks in place in case performance is a concern.

5 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.