Rust conventions: Difference between revisions

From wikinotes
Line 4: Line 4:
<blockquote>
<blockquote>
<syntaxhighlight lang="rust">
<syntaxhighlight lang="rust">
fn do_thing() { ... }  // functions are snake-case
fn do_thing() { ... }           // functions are snake-case
let user_name: &str = "vaderd"; // variables are snake-case
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- Casing -->
</blockquote><!-- Casing -->

Revision as of 21:54, 6 February 2023

Naming

Casing

fn do_thing() { ... }            // functions are snake-case
let user_name: &str = "vaderd";  // variables are snake-case

Spacing

4x spaces