Skip to content

Commit 0b4e653

Browse files
committed
Use eprintln! instead of custom macro
1 parent 5fa5ff2 commit 0b4e653

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

rdkafka-sys/build.rs

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ use std::io::Write;
88
use std::path::{Path, PathBuf};
99
use std::process::{self, Command};
1010

11-
macro_rules! println_stderr(
12-
($($arg:tt)*) => { {
13-
let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
14-
r.expect("failed printing to stderr");
15-
} }
16-
);
17-
1811
fn run_command_or_fail<P>(dir: &str, cmd: P, args: &[&str])
1912
where
2013
P: AsRef<Path>,
@@ -32,7 +25,7 @@ where
3225
} else {
3326
PathBuf::from(cmd)
3427
};
35-
println_stderr!(
28+
eprintln!(
3629
"Running command: \"{} {}\" in dir: {}",
3730
cmd.display(),
3831
args.join(" "),
@@ -54,34 +47,34 @@ fn main() {
5447
.expect("Crate version is not valid");
5548

5649
if env::var("CARGO_FEATURE_DYNAMIC_LINKING").is_ok() {
57-
println_stderr!("librdkafka will be linked dynamically");
50+
eprintln!("librdkafka will be linked dynamically");
5851
let pkg_probe = pkg_config::Config::new()
5952
.cargo_metadata(true)
6053
.atleast_version(librdkafka_version)
6154
.probe("rdkafka");
6255

6356
match pkg_probe {
6457
Ok(library) => {
65-
println_stderr!("librdkafka found on the system:");
66-
println_stderr!(" Name: {:?}", library.libs);
67-
println_stderr!(" Path: {:?}", library.link_paths);
68-
println_stderr!(" Version: {}", library.version);
58+
eprintln!("librdkafka found on the system:");
59+
eprintln!(" Name: {:?}", library.libs);
60+
eprintln!(" Path: {:?}", library.link_paths);
61+
eprintln!(" Version: {}", library.version);
6962
}
7063
Err(_) => {
71-
println_stderr!(
64+
eprintln!(
7265
"librdkafka {} cannot be found on the system",
7366
librdkafka_version
7467
);
75-
println_stderr!("Dynamic linking failed. Exiting.");
68+
eprintln!("Dynamic linking failed. Exiting.");
7669
process::exit(1);
7770
}
7871
}
7972
} else {
8073
if !Path::new("librdkafka/LICENSE").exists() {
81-
println_stderr!("Setting up submodules");
74+
eprintln!("Setting up submodules");
8275
run_command_or_fail("../", "git", &["submodule", "update", "--init"]);
8376
}
84-
println_stderr!("Building and linking librdkafka statically");
77+
eprintln!("Building and linking librdkafka statically");
8578
build_librdkafka();
8679
}
8780

0 commit comments

Comments
 (0)