Skip to content

Commit 9d23d25

Browse files
committed
refactor: drop --debug flag
1 parent aa3d4cc commit 9d23d25

File tree

8 files changed

+9
-83
lines changed

8 files changed

+9
-83
lines changed

Cargo.lock

+5-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ rayon = "*"
77
rnix = "*"
88
termion = "*"
99
tui = { version = "*", default-features = false, features = ["termion"] }
10-
rowan = "*"
10+
rowan = "0.12.6" # follows rnix
1111
walkdir = "*"
1212

1313
[package]

src/cli.rs

-7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ pub fn parse(args: Vec<String>) -> clap::ArgMatches {
22
clap::Command::new("Alejandra")
33
.about("The Uncompromising Nix Code Formatter.")
44
.version(crate::version::VERSION)
5-
.arg(
6-
clap::Arg::new("debug")
7-
.help("Enable debug mode.")
8-
.long("debug")
9-
.short('d')
10-
.takes_value(false),
11-
)
125
.arg(
136
clap::Arg::new("paths")
147
.help("Files or directories, or none to format stdin.")

src/config.rs

+2-11
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,19 @@ pub enum Layout {
66

77
#[derive(Clone)]
88
pub struct Config {
9-
debug: bool,
109
layout: Layout,
1110
}
1211

1312
impl Config {
1413
pub fn new() -> Config {
15-
Config { debug: false, layout: Layout::Tall }
16-
}
17-
18-
pub fn debug(&self) -> bool {
19-
self.debug
14+
Config { layout: Layout::Tall }
2015
}
2116

2217
pub fn layout(&self) -> &Layout {
2318
&self.layout
2419
}
2520

26-
pub fn with_debug(&self, debug: bool) -> Config {
27-
Config { debug, layout: self.layout.clone() }
28-
}
29-
3021
pub fn with_layout(&self, layout: Layout) -> Config {
31-
Config { debug: self.debug, layout }
22+
Config { layout }
3223
}
3324
}

src/debug.rs

-27
This file was deleted.

src/format.rs

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ pub fn string(
1414
let green_node =
1515
crate::builder::build(config, ast.node().into(), false, path).unwrap();
1616

17-
if config.debug() {
18-
crate::debug::display(&(&green_node).into());
19-
}
20-
2117
green_node.to_string()
2218
}
2319

src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ pub mod builder;
22
pub mod children;
33
pub mod cli;
44
pub mod config;
5-
pub mod debug;
65
pub mod find;
76
pub mod format;
87
pub mod position;

src/main.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
fn main() -> std::io::Result<()> {
22
let matches = alejandra::cli::parse(std::env::args().collect());
33

4-
let debug: bool = matches.is_present("debug");
5-
let config = alejandra::config::Config::new().with_debug(debug);
4+
let config = alejandra::config::Config::new();
65

76
match matches.values_of("paths") {
87
Some(paths) => {

0 commit comments

Comments
 (0)