5 Clean up your codebase
This chapter covers
- Grouping your functions into modules
- Splitting your modules into files
- Creating a practical folder structure within your Rust project
- Understanding the difference between doc comments and hidden comments
- Adding example code in your comments and testing it
- Using Clippy to lint your code
- Using Cargo to format and compile your codebase
Rust comes equipped with a large set of tools that makes it easy to organize, structure, test, and comment it. The ecosystem values good documentation style, which is the reason Rust has a built-in commenting system that generates code documentation on the fly, and even tests the code in your comments so your documentation is never out-of-date.
A widely supported linter ...
Get Rust Web Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.