Tokio projects follow specific import conventions for consistency and readability. Adhere to these guidelines: 1. Use separate `use` statements for different modules
Tokio projects follow specific import conventions for consistency and readability. Adhere to these guidelines:
use
statements for different modules// Incorrect
use std::{
future::Future,
os::unix::io::{AsRawFd, RawFd},
};
// Correct
use std::future::Future;
use std::os::unix::io::{AsRawFd, RawFd};
// Incorrect - safety comment is too far from unsafe block
let filled = read.filled().len();
// Safety: This is guaranteed by invariants...
unsafe { pin.rd.advance_mut(filled) };
// Correct
// Safety: This is guaranteed by invariants...
unsafe { pin.rd.advance_mut(read.filled().len()) };
Following consistent import style and proper safety comment placement improves code readability and maintainability across the project.
Enter the URL of a public GitHub repository