tailhook / vagga

Vagga is a containerization tool without daemons
http://vagga.readthedocs.org
MIT License
1.86k stars 96 forks source link

Rust 2018 #556

Closed anti-social closed 2 years ago

anti-social commented 2 years ago

Need for #555

As we have to refactor crate imports anyway to be able to use async feature. So which one do you prefer?

An old way:

#[cfg(feature="containers")]
use crate::builder::context::Context;
#[cfg(feature="containers")]
use crate::builder::packages;
#[cfg(feature="containers")]
use crate::builder::commands::generic::{run_command_at_env, capture_command};
use build_step::{BuildStep, VersionError, StepError, Digest, Config, Guard};
use crate::file_util::copy;

or a compact one:

#[cfg(feature="containers")]
use crate::{
    builder::context::Context,
    builder::packages,
    builder::commands::generic::{run_command_at_env, capture_command},
};
use crate::{
    build_step::{BuildStep, VersionError, StepError, Digest, Config, Guard},
    file_util::copy,
};
anti-social commented 2 years ago

Possibly we can go further:

#[cfg(feature="containers")]
use crate::{
    builder::{
        context::Context,
        packages,
        commands::generic::{run_command_at_env, capture_command},
    },
};
anti-social commented 2 years ago

I like the second option.

tailhook commented 2 years ago

I think you can use indented block with cfg(feature as an exception. But for non optional blocks, please, use one use per line. It's easier to grep, copy and even read most of the time.

tailhook commented 2 years ago

Also feel free to convert to 2021 right away. It should be much easier change after 2018.