all: change macros

- Change the main! proc_macro to a bin! macro_rules macro.
- Reexport uucore_procs from uucore
- Make utils to not import uucore_procs directly
- Remove the `syn` dependency and don't parse proc_macro input (hopefully for faster compile times)
This commit is contained in:
Terts Diepraam
2022-01-29 15:26:32 +01:00
parent 1dcd3b2c24
commit eb82015b23
308 changed files with 222 additions and 716 deletions
Generated
+1 -102
View File
File diff suppressed because it is too large Load Diff
-4
View File
@@ -18,11 +18,7 @@ path = "src/arch.rs"
platform-info = "0.2"
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
[[bin]]
name = "arch"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]
+1 -1
View File
@@ -14,7 +14,7 @@ use uucore::error::{FromIo, UResult};
static ABOUT: &str = "Display machine architecture";
static SUMMARY: &str = "Determine architecture name for current machine.";
#[uucore_procs::gen_uumain]
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
uu_app().get_matches_from(args);
+1 -1
View File
@@ -1 +1 @@
uucore_procs::main!(uu_arch);
uucore::bin!(uu_arch);
-4
View File
@@ -17,11 +17,7 @@ path = "src/base32.rs"
[dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features = ["encoding"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
[[bin]]
name = "base32"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]
+1 -1
View File
@@ -26,7 +26,7 @@ fn usage() -> String {
format!("{0} [OPTION]... [FILE]", uucore::execution_phrase())
}
#[uucore_procs::gen_uumain]
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let format = Format::Base32;
let usage = usage();
+1 -1
View File
@@ -1 +1 @@
uucore_procs::main!(uu_base32);
uucore::bin!(uu_base32);
-4
View File
@@ -16,12 +16,8 @@ path = "src/base64.rs"
[dependencies]
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features = ["encoding"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
uu_base32 = { version=">=0.0.8", package="uu_base32", path="../base32"}
[[bin]]
name = "base64"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]
+1 -1
View File
@@ -27,7 +27,7 @@ fn usage() -> String {
format!("{0} [OPTION]... [FILE]", uucore::execution_phrase())
}
#[uucore_procs::gen_uumain]
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let format = Format::Base64;
let usage = usage();
+1 -1
View File
@@ -1 +1 @@
uucore_procs::main!(uu_base64);
uucore::bin!(uu_base64);
-4
View File
@@ -17,11 +17,7 @@ path = "src/basename.rs"
[dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
[[bin]]
name = "basename"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]
+1 -1
View File
@@ -31,7 +31,7 @@ pub mod options {
pub static ZERO: &str = "zero";
}
#[uucore_procs::gen_uumain]
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let args = args
.collect_str(InvalidEncodingHandling::ConvertLossy)
+1 -1
View File
@@ -1 +1 @@
uucore_procs::main!(uu_basename);
uucore::bin!(uu_basename);
-4
View File
@@ -17,12 +17,8 @@ path = "src/basenc.rs"
[dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features = ["encoding"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
uu_base32 = { version=">=0.0.8", package="uu_base32", path="../base32"}
[[bin]]
name = "basenc"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]
+1 -1
View File
@@ -65,7 +65,7 @@ fn parse_cmd_args(args: impl uucore::Args) -> UResult<(Config, Format)> {
Ok((config, format))
}
#[uucore_procs::gen_uumain]
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let (config, format) = parse_cmd_args(args)?;
// Create a reference to stdin so we can return a locked stdin from
+1 -1
View File
@@ -1 +1 @@
uucore_procs::main!(uu_basenc);
uucore::bin!(uu_basenc);
-4
View File
@@ -19,7 +19,6 @@ clap = { version = "3.0", features = ["wrap_help", "cargo"] }
thiserror = "1.0"
atty = "0.2"
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["fs", "pipes"] }
uucore_procs = { version=">=0.0.8", package="uucore_procs", path="../../uucore_procs" }
[target.'cfg(unix)'.dependencies]
unix_socket = "0.5.0"
@@ -31,6 +30,3 @@ winapi-util = "0.1.5"
[[bin]]
name = "cat"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]
+1 -1
View File
@@ -182,7 +182,7 @@ mod options {
pub static SHOW_NONPRINTING: &str = "show-nonprinting";
}
#[uucore_procs::gen_uumain]
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let args = args
.collect_str(InvalidEncodingHandling::Ignore)
+1 -1
View File
@@ -1 +1 @@
uucore_procs::main!(uu_cat);
uucore::bin!(uu_cat);
-4
View File
@@ -16,7 +16,6 @@ path = "src/chcon.rs"
[dependencies]
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version = ">=0.0.9", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] }
uucore_procs = { version = ">=0.0.6", package="uucore_procs", path="../../uucore_procs" }
selinux = { version = "0.2" }
fts-sys = { version = "0.2" }
thiserror = { version = "1.0" }
@@ -25,6 +24,3 @@ libc = { version = "0.2" }
[[bin]]
name = "chcon"
path = "src/main.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["uucore_procs"]

Some files were not shown because too many files have changed in this diff Show More