Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix makers formatting #535

Merged
merged 3 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/lib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@
//! [Apache 2](https://github.com/sagiegurari/cargo-make/blob/master/LICENSE) open source license.
//!

// Dependencies used in the binary `makers`:
#[cfg(windows)]
use ansi_term as _;

#[macro_use]
extern crate log;
#[macro_use]
Expand Down Expand Up @@ -195,9 +199,5 @@ mod version;

/// Handles the command line arguments and executes the runner.
pub fn run_cli(command_name: String, sub_command: bool) {
#[cfg(windows)]
if let Err(err) = ansi_term::enable_ansi_support() {
eprintln!("error enabling ANSI support: {:?}", err);
}
cli::run_cli(command_name, sub_command)
}
2 changes: 2 additions & 0 deletions src/makers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ fn get_name() -> String {
}

fn main() {
#[cfg(windows)]
let _ = ansi_term::enable_ansi_support();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question, do we need the let _ here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternative would be something like:

#[allow(unused_must_use)]
{
      #[cfg(windows)]
      ansi_term::enable_ansi_support();
}

I didn't test it but I've found this workaround on stackoverflow or a Rust forum / issue.

This doesn't work for some reasons:

#[allow(unused_must_use)]
#[cfg(windows)]
ansi_term::enable_ansi_support();

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets leave it. thanks for the explanation.

let name = get_name();
cli::run_cli(name, false);
}