mirror of
https://gitee.com/openharmony/third_party_rust_termcolor
synced 2024-11-27 01:30:23 +00:00
edition: switch to Rust 2018
This commit is contained in:
parent
13cf626d91
commit
975fcd18cc
@ -12,6 +12,7 @@ readme = "README.md"
|
||||
keywords = ["windows", "win", "color", "ansi", "console"]
|
||||
license = "Unlicense OR MIT"
|
||||
exclude = ["/.travis.yml", "/appveyor.yml", "/ci/**"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "termcolor"
|
||||
|
14
src/lib.rs
14
src/lib.rs
@ -71,12 +71,8 @@ bufwtr.print(&buffer)?;
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
#[cfg(windows)]
|
||||
extern crate winapi_util;
|
||||
#[cfg(test)]
|
||||
#[macro_use]
|
||||
extern crate doc_comment;
|
||||
|
||||
use doc_comment::doctest;
|
||||
#[cfg(test)]
|
||||
doctest!("../README.md");
|
||||
|
||||
@ -265,7 +261,7 @@ impl IoStandardStream {
|
||||
}
|
||||
}
|
||||
|
||||
fn lock(&self) -> IoStandardStreamLock {
|
||||
fn lock(&self) -> IoStandardStreamLock<'_> {
|
||||
match *self {
|
||||
IoStandardStream::Stdout(ref s) => {
|
||||
IoStandardStreamLock::StdoutLock(s.lock())
|
||||
@ -416,14 +412,14 @@ impl StandardStream {
|
||||
///
|
||||
/// This method is **not reentrant**. It may panic if `lock` is called
|
||||
/// while a `StandardStreamLock` is still alive.
|
||||
pub fn lock(&self) -> StandardStreamLock {
|
||||
pub fn lock(&self) -> StandardStreamLock<'_> {
|
||||
StandardStreamLock::from_stream(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StandardStreamLock<'a> {
|
||||
#[cfg(not(windows))]
|
||||
fn from_stream(stream: &StandardStream) -> StandardStreamLock {
|
||||
fn from_stream(stream: &StandardStream) -> StandardStreamLock<'_> {
|
||||
let locked = match *stream.wtr.get_ref() {
|
||||
WriterInner::NoColor(ref w) => {
|
||||
WriterInnerLock::NoColor(NoColor(w.0.lock()))
|
||||
@ -1854,7 +1850,7 @@ impl error::Error for ParseColorError {
|
||||
}
|
||||
|
||||
impl fmt::Display for ParseColorError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use self::ParseColorErrorKind::*;
|
||||
match self.kind {
|
||||
InvalidName => write!(
|
||||
|
Loading…
Reference in New Issue
Block a user