mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 09:48:05 +03:00
scm/mononoke: convert phases to use std::convert::TryFrom
Summary: Remove use of try_from crate now that it's stable. Reviewed By: farnz Differential Revision: D17550530 fbshipit-source-id: 1537af929fb294a725a44003fa5c34620a4cba3b
This commit is contained in:
parent
2b359e1501
commit
33637c936e
@ -17,10 +17,10 @@ use mononoke_types::{ChangesetId, RepositoryId};
|
||||
use stats::{define_stats, Timeseries};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
convert::TryInto,
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
use try_from::TryInto;
|
||||
|
||||
// Memcache constants, should be changed when we want to invalidate memcache
|
||||
// entries
|
||||
|
@ -29,9 +29,9 @@ pub use sql_ext::SqlConstructors;
|
||||
use stats::{define_stats, Timeseries};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
convert::TryFrom,
|
||||
fmt,
|
||||
};
|
||||
use try_from::TryFrom;
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
pub enum Phase {
|
||||
@ -58,9 +58,9 @@ impl fmt::Display for Phase {
|
||||
}
|
||||
|
||||
impl TryFrom<iobuf::IOBuf> for Phase {
|
||||
type Err = ErrorKind;
|
||||
type Error = ErrorKind;
|
||||
|
||||
fn try_from(buf: iobuf::IOBuf) -> ::std::result::Result<Self, Self::Err> {
|
||||
fn try_from(buf: iobuf::IOBuf) -> ::std::result::Result<Self, Self::Error> {
|
||||
let v: Vec<u8> = buf.into();
|
||||
match std::str::from_utf8(&v) {
|
||||
Ok("Draft") => Ok(Phase::Draft),
|
||||
|
Loading…
Reference in New Issue
Block a user