Import Path and PathBuf directly

This commit is contained in:
David Tolnay 2017-04-13 16:38:04 -07:00
parent fb7964fde7
commit dbe7d04282
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
3 changed files with 10 additions and 8 deletions

View File

@ -948,20 +948,20 @@ struct PathBufVisitor;
#[cfg(feature = "std")]
impl<'de> Visitor<'de> for PathBufVisitor {
type Value = path::PathBuf;
type Value = PathBuf;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("path string")
}
fn visit_str<E>(self, v: &str) -> Result<path::PathBuf, E>
fn visit_str<E>(self, v: &str) -> Result<PathBuf, E>
where
E: Error,
{
Ok(From::from(v))
}
fn visit_string<E>(self, v: String) -> Result<path::PathBuf, E>
fn visit_string<E>(self, v: String) -> Result<PathBuf, E>
where
E: Error,
{
@ -971,8 +971,8 @@ impl<'de> Visitor<'de> for PathBufVisitor {
#[cfg(feature = "std")]
impl<'de> Deserialize<'de> for path::PathBuf {
fn deserialize<D>(deserializer: D) -> Result<path::PathBuf, D::Error>
impl<'de> Deserialize<'de> for PathBuf {
fn deserialize<D>(deserializer: D) -> Result<PathBuf, D::Error>
where
D: Deserializer<'de>,
{

View File

@ -162,7 +162,7 @@ mod lib {
pub use collections::{BinaryHeap, BTreeMap, BTreeSet, LinkedList, VecDeque};
#[cfg(feature = "std")]
pub use std::{error, net, path};
pub use std::{error, net};
#[cfg(feature = "std")]
pub use std::collections::{HashMap, HashSet};
@ -173,6 +173,8 @@ mod lib {
#[cfg(feature = "std")]
pub use std::io::Write;
#[cfg(feature = "std")]
pub use std::path::{Path, PathBuf};
#[cfg(feature = "std")]
pub use std::time::Duration;
#[cfg(feature = "unstable")]

View File

@ -472,7 +472,7 @@ impl Serialize for net::SocketAddrV6 {
////////////////////////////////////////////////////////////////////////////////
#[cfg(feature = "std")]
impl Serialize for path::Path {
impl Serialize for Path {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
@ -485,7 +485,7 @@ impl Serialize for path::Path {
}
#[cfg(feature = "std")]
impl Serialize for path::PathBuf {
impl Serialize for PathBuf {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,