Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit cfe1706

Browse files
authored
Merge pull request #65 from rust-lang-nursery/split-into-two-crates
Split rustfix into two crates
2 parents 820dda2 + 8313660 commit cfe1706

File tree

5 files changed

+31
-10
lines changed

5 files changed

+31
-10
lines changed

Cargo.toml

+9-3
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@ description = "Automatically apply the suggestions made by rustc"
99
repository = "https://github.com/killercup/rustfix"
1010
documentation = "https://docs.rs/rustfix"
1111
readme = "README.md"
12-
version = "0.1.0"
12+
version = "0.2.0"
1313
exclude = [
1414
"etc/*",
1515
"examples/*",
1616
"tests/*",
1717
]
1818

1919
[dependencies]
20-
clap = "2.9.2"
21-
colored = "1.2.0"
2220
quick-error = "1.2.1"
2321
serde = "1.0"
2422
serde_json = "1.0"
@@ -30,3 +28,11 @@ env_logger = "0.5.0-rc.1"
3028
log = "0.4.1"
3129
pretty_assertions = "0.4.1"
3230
tempdir = "0.3.5"
31+
32+
[workspace]
33+
members = [
34+
"cargo-fix",
35+
]
36+
37+
[patch.crates-io]
38+
rustfix = { path = "." }

cargo-fix/Cargo.toml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[package]
2+
name = "cargo-fix"
3+
version = "0.2.0"
4+
authors = ["Pascal Hertleif <[email protected]>"]
5+
6+
[dependencies]
7+
clap = "2.9.2"
8+
colored = "1.2.0"
9+
quick-error = "1.2.1"
10+
serde = "1.0"
11+
serde_json = "1.0"
12+
serde_derive = "1.0"
13+
rustfix = "0.1.0"

src/main.rs renamed to cargo-fix/src/main.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ const ALIASES: &[(&str, &[&str])] = &[
5555
];
5656

5757
fn try_main() -> Result<(), ProgramError> {
58-
let matches = App::new("rustfix")
58+
// Quickfix to be usable as rustfix as well as cargo-fix
59+
let args = if ::std::env::args_os().nth(1).map(|x| &x == "fix").unwrap_or(false) {
60+
::std::env::args_os().skip(1)
61+
} else {
62+
::std::env::args_os().skip(0)
63+
};
64+
65+
let matches = App::new("cargo-fix")
5966
.about("Automatically apply suggestions made by rustc")
6067
.version(crate_version!())
6168
.arg(Arg::with_name("clippy")
@@ -72,7 +79,7 @@ fn try_main() -> Result<(), ProgramError> {
7279
.long("file")
7380
.takes_value(true)
7481
.help("Load errors from the given JSON file (produced by `cargo build --message-format=json`)"))
75-
.get_matches();
82+
.get_matches_from(args);
7683

7784
let mut extra_args = Vec::new();
7885

src/bin/cargo-fix.rs

-4
This file was deleted.

src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ extern crate serde_derive;
33
extern crate serde_json;
44

55
use std::collections::HashSet;
6-
use std::error::Error;
76

87
pub mod diagnostics;
98
use diagnostics::{Diagnostic, DiagnosticSpan};

0 commit comments

Comments
 (0)