Skip to content

Commit

Permalink
fix: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
KolbyML committed Dec 8, 2024
1 parent d36ffd0 commit 850cca2
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions book/src/developers/contributing/rust/imports.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
# Imports

- In `*.rs` files, imports should be split into 3 groups [src](https://github.com/rust-dev-tools/fmt-rfcs/issues/131) and separated by a single line. Within a single group, imported items should be sorted alphabetically.
- Imports from `'std'`
- Imports from external crates
- Imports from crates within trin
- In `*.rs` files, imports should be split into 3 groups [src](https://rust-lang.github.io/rustfmt/?version=v1.6.0&search=#StdExternalCrate) and separated by a single line. Within a single group, imported items should be sorted alphabetically.
1. std, core and alloc,
2. external crates,
3. self, super and crate imports.
- Alphabetize imports in `Cargo.toml`

```rust
use alloc::alloc::Layout;
use core::f32;
use std::sync::Arc;

use broker::database::PooledConnection;
use chrono::Utc;
use juniper::{FieldError, FieldResult};
use uuid::Uuid;

use super::schema::{Context, Payload};
use super::update::convert_publish_payload;
use crate::models::Event;
```

0 comments on commit 850cca2

Please sign in to comment.