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

Changes minimum documented rust version to 1.28 #76

Merged
merged 1 commit into from Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
@@ -1,7 +1,7 @@
# pkg-config-rs

[![Build Status](https://travis-ci.com/alexcrichton/pkg-config-rs.svg?branch=master)](https://travis-ci.com/alexcrichton/pkg-config-rs)
[![Rust](https://img.shields.io/badge/rust-1.13%2B-blue.svg?maxAge=3600)](https://github.com/alexcrichton/pkg-config-rs/)
[![Rust](https://img.shields.io/badge/rust-1.28%2B-blue.svg?maxAge=3600)](https://github.com/alexcrichton/pkg-config-rs/)

[Documentation](https://docs.rs/pkg-config)

Expand All @@ -13,7 +13,7 @@ You can use this crate directly to probe for specific libraries, or use
[metadeps](https://github.com/joshtriplett/metadeps) to declare all your
`pkg-config` dependencies in `Cargo.toml`.

This library requires Rust 1.13+.
This library requires Rust 1.28+.

# Example

Expand Down
54 changes: 1 addition & 53 deletions src/lib.rs
Expand Up @@ -109,6 +109,7 @@ pub struct Library {
}

/// Represents all reasons `pkg-config` might not succeed or be run at all.
#[derive(Debug)]
pub enum Error {
/// Aborted because of `*_NO_PKG_CONFIG` environment variable.
///
Expand Down Expand Up @@ -157,59 +158,6 @@ impl error::Error for Error {
}
}

// Workaround for temporary lack of impl Debug for Output in stable std
struct OutputDebugger<'a>(&'a Output);

// Lifted from 1.7 std
impl<'a> fmt::Debug for OutputDebugger<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let stdout_utf8 = str::from_utf8(&self.0.stdout);
let stdout_debug: &fmt::Debug = match stdout_utf8 {
Ok(ref str) => str,
Err(_) => &self.0.stdout
};

let stderr_utf8 = str::from_utf8(&self.0.stderr);
let stderr_debug: &fmt::Debug = match stderr_utf8 {
Ok(ref str) => str,
Err(_) => &self.0.stderr
};

fmt.debug_struct("Output")
.field("status", &self.0.status)
.field("stdout", stdout_debug)
.field("stderr", stderr_debug)
.finish()
}
}

// Workaround for temporary lack of impl Debug for Output in stable std, continued
impl fmt::Debug for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
match *self {
Error::EnvNoPkgConfig(ref name) => {
f.debug_tuple("EnvNoPkgConfig")
.field(name)
.finish()
}
Error::CrossCompilation => write!(f, "CrossCompilation"),
Error::Command { ref command, ref cause } => {
f.debug_struct("Command")
.field("command", command)
.field("cause", cause)
.finish()
}
Error::Failure { ref command, ref output } => {
f.debug_struct("Failure")
.field("command", command)
.field("output", &OutputDebugger(output))
.finish()
}
Error::__Nonexhaustive => panic!(),
}
}
}

impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
match *self {
Expand Down