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

Replace all Into with From #4792

Merged
merged 3 commits into from
May 28, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions components/cop_datatype/src/builder/field_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ impl FieldTypeBuilder {
}
}

impl Into<FieldType> for FieldTypeBuilder {
fn into(self) -> FieldType {
self.build()
impl From<FieldTypeBuilder> for FieldType {
fn from(fp_builder: FieldTypeBuilder) -> FieldType {
fp_builder.build()
}
}
12 changes: 6 additions & 6 deletions components/cop_datatype/src/def/field_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,18 +309,18 @@ impl FieldTypeAccessor for ColumnInfo {
}
}

impl Into<FieldType> for FieldTypeTp {
fn into(self) -> FieldType {
impl From<FieldTypeTp> for FieldType {
fn from(fp: FieldTypeTp) -> FieldType {
let mut ft = FieldType::new();
ft.as_mut_accessor().set_tp(self);
ft.as_mut_accessor().set_tp(fp);
ft
}
}

impl Into<ColumnInfo> for FieldTypeTp {
fn into(self) -> ColumnInfo {
impl From<FieldTypeTp> for ColumnInfo {
fn from(fp: FieldTypeTp) -> ColumnInfo {
let mut ft = ColumnInfo::new();
ft.as_mut_accessor().set_tp(self);
ft.as_mut_accessor().set_tp(fp);
ft
}
}
6 changes: 3 additions & 3 deletions components/engine/src/rocks/util/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ pub enum CompressionType {
ZstdNotFinal,
}

impl Into<DBCompressionType> for CompressionType {
fn into(self) -> DBCompressionType {
match self {
impl From<CompressionType> for DBCompressionType {
fn from(compression_type: CompressionType) -> DBCompressionType {
match compression_type {
CompressionType::No => DBCompressionType::No,
CompressionType::Snappy => DBCompressionType::Snappy,
CompressionType::Zlib => DBCompressionType::Zlib,
Expand Down
6 changes: 3 additions & 3 deletions components/tikv_util/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ impl<'de> Deserialize<'de> for ReadableSize {
#[derive(Clone, Debug, PartialEq)]
pub struct ReadableDuration(pub Duration);

impl Into<Duration> for ReadableDuration {
fn into(self) -> Duration {
self.0
impl From<ReadableDuration> for Duration {
fn from(readable: ReadableDuration) -> Duration {
readable.0
}
}

Expand Down
6 changes: 3 additions & 3 deletions components/tipb_helper/src/expr_def_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ impl ExprDefBuilder {
}
}

impl Into<Expr> for ExprDefBuilder {
fn into(self) -> Expr {
self.build()
impl From<ExprDefBuilder> for Expr {
fn from(expr_def_builder: ExprDefBuilder) -> Expr {
expr_def_builder.build()
}
}
8 changes: 4 additions & 4 deletions src/coprocessor/codec/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ impl Error {
}
}

impl Into<select::Error> for Error {
fn into(self) -> select::Error {
impl From<Error> for select::Error {
fn from(error: Error) -> select::Error {
let mut err = select::Error::new();
err.set_code(self.code());
err.set_msg(format!("{:?}", self));
err.set_code(error.code());
err.set_msg(format!("{:?}", error));
err
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/coprocessor/codec/mysql/time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ pub enum TimeType {
Timestamp,
}

impl Into<FieldTypeTp> for TimeType {
fn into(self) -> FieldTypeTp {
match self {
impl From<TimeType> for FieldTypeTp {
fn from(time_type: TimeType) -> FieldTypeTp {
match time_type {
TimeType::Date => FieldTypeTp::Date,
TimeType::DateTime => FieldTypeTp::DateTime,
TimeType::Timestamp => FieldTypeTp::Timestamp,
Expand Down
8 changes: 4 additions & 4 deletions src/raftstore/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ quick_error! {

pub type Result<T> = result::Result<T, Error>;

impl Into<errorpb::Error> for Error {
fn into(self) -> errorpb::Error {
impl From<Error> for errorpb::Error {
fn from(err: Error) -> errorpb::Error {
let mut errorpb = errorpb::Error::new();
errorpb.set_message(error::Error::description(&self).to_owned());
errorpb.set_message(error::Error::description(&err).to_owned());

match self {
match err {
Error::RegionNotFound(region_id) => {
errorpb.mut_region_not_found().set_region_id(region_id);
}
Expand Down
6 changes: 3 additions & 3 deletions src/server/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ impl From<debugpb::BottommostLevelCompaction> for BottommostLevelCompaction {
}
}

impl Into<debugpb::BottommostLevelCompaction> for BottommostLevelCompaction {
fn into(self) -> debugpb::BottommostLevelCompaction {
match self.0 {
impl From<BottommostLevelCompaction> for debugpb::BottommostLevelCompaction {
fn from(bottommost: BottommostLevelCompaction) -> debugpb::BottommostLevelCompaction {
match bottommost.0 {
DBBottommostLevelCompaction::Skip => debugpb::BottommostLevelCompaction::Skip,
DBBottommostLevelCompaction::Force => debugpb::BottommostLevelCompaction::Force,
DBBottommostLevelCompaction::IfHaveCompactionFilter => {
Expand Down