Use declaration convention

Hi, I want to know if there is a best practice for 'use declaration'. For example:

// use std
use std::a::b
use std::c::d
// a blank line to avoid rustfmt mess up
// use external crate
use tokio::e::f
use rand::g::h
// a blank line to avoid rustfmt mess up
// use user-defined mod
use my_mod::{i, j}

Or it's just personal taste?

I highly doubt there's any strong rules for what you're asking

I personally also do what you do as well.

I start off with my own modules, then std, then I also group other imports based on where I need them

use crate::functions::*;
use actions::*;
use state::userstate::*;

use std::fs::*;
use std::sync::Arc;
use std::time::Duration;

use async_trait::async_trait;
use once_cell::sync::Lazy;
use snips_nlu_lib::SnipsNluEngine;

Again, I'm hardly any authority. But I don't think what you're doing is weird.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.