All Posts

Introducing, DeepSource for Rust

Introducing, DeepSource for Rust

Rust is a popular systems programming language. It has been consistently titled as the most loved programming language of the year by Stack Overflow, for five years in a row. Rust is a compiled language with a minimal runtime, and its rich type system and ownership model guarantees memory-safety and thread-safety to help write performant and reliable software. It has taken the industry by storm for its novel safety guarantees and speed. However, given the recency of some of Rust's features, users often find it hard to learn, especially when compared to other languages in the same space.

DeepSource for Rust

The static analysis ecosystem for Rust has largely been dominated by rust-clippy, with over 400 lints. So why bother with DeepSource?

At DeepSource, we build upon the innovation already brought by the community and make the results of static analysis more manageable and actionable to you. We guarantee less than 5% of false-positives in the issues, help you run analysis continuously on every commit and pull-request with an almost instant configuration.

In this beta release, the Rust Analyzer detects 50+ different types of issues, including performance hiccups, bug risks, anti-patterns and style issues. To top it off, DeepSource's Rust Analyzer automatically fixes various issues in your codebase with a click of a button!

Sample issues

Here are a few examples of issues that the Rust Analyzer can detect (and automatically fix!):

fold method calls that have more readable std alternatives:


let _ = (0..5).fold(false, |acc, x| acc || x > 2);

// is better written as
let _ = (0..5).any(|x| x > 2);

Calls to std::env functions that use string literals instead of static strings:


std::env::var("RUST_BACKTRACE");
// elsewhere ...
std::env::remove_var("RUST_BACKTRCAE"); // oops, misspelled

// prefer using static strings
static RUST_BACKTRACE: &str = "RUST_BACKTRACE";
std::env::var(RUST_BACKTRACE);
std::env::remove_var(RUST_BACKTRACE);

Start using the Rust Analyzer

Getting started with the Rust Analyzer is almost too easy. If you already use DeepSource, just add a new entry into the [[analyzers]] table, if not, simply include the following TOML file in your repository root as .deepsource.toml:


version = 1

[[analyzers]]
name = "rust"
enabled = true

Head over to the DeepSource dashboard and activate your repository. Alternatively, just activate your Rust repository from the dashboard after using the configuration generator.

We are constantly making improvements to performance as well as the quality of analysis. Give it a go and let us know what you think about it on Twitter! Feel free to reach out to us on the Discuss forum if you have any queries. DeepSource's Rust Analyzer guarantees a false-positive rate of less than 5%. If you ever find a false-positive in an issue detected by the Analyzer, please make sure to report it and we'll get back to you.

Get started with DeepSource

DeepSource is free forever for small teams and open-source projects. Start analyzing your code in less than 2 minutes.

Newsletter

Read product updates, company announcements, how we build DeepSource, what we think about good code, and more.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.