Is there a way to optimize and format all crate imports in scope, to clean up the imports sections? The problem is that the imports get crowded and stack up.
Before:
use actix_web::web::{Data, Payload};
use actix_web::Error;
use actix_web::{
error::{BlockingError, ErrorUnauthorized},
web, HttpResponse,
};
After:
use actix_web::{web::
{Data, Payload},
Error,
error::{BlockingError, ErrorUnauthorized},
web, HttpResponse,
};
Actually rustfmt
can do this. Create a rustfmt.toml
configuration file in your project directory and specify the following:
merge_imports = true
The rustfmt
has more configurable options if you are interested.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.