Remove unnecessary std::convert::From implementations
This commit is contained in:
parent
ea525648ae
commit
56f5f10046
8 changed files with 19 additions and 49 deletions
|
@ -720,7 +720,7 @@ impl Transaction {
|
||||||
.put(
|
.put(
|
||||||
key,
|
key,
|
||||||
DefineNamespaceStatement {
|
DefineNamespaceStatement {
|
||||||
name: ns.into(),
|
name: ns.to_owned().into(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
@ -733,7 +733,7 @@ impl Transaction {
|
||||||
.put(
|
.put(
|
||||||
key,
|
key,
|
||||||
DefineDatabaseStatement {
|
DefineDatabaseStatement {
|
||||||
name: db.into(),
|
name: db.to_owned().into(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
@ -746,7 +746,7 @@ impl Transaction {
|
||||||
.put(
|
.put(
|
||||||
key,
|
key,
|
||||||
DefineTableStatement {
|
DefineTableStatement {
|
||||||
name: tb.into(),
|
name: tb.to_owned().into(),
|
||||||
..DefineTableStatement::default()
|
..DefineTableStatement::default()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -36,19 +36,7 @@ impl From<Vec<Value>> for Array {
|
||||||
|
|
||||||
impl From<Vec<i32>> for Array {
|
impl From<Vec<i32>> for Array {
|
||||||
fn from(v: Vec<i32>) -> Self {
|
fn from(v: Vec<i32>) -> Self {
|
||||||
Array(v.into_iter().map(|x| x.into()).collect())
|
Array(v.into_iter().map(Value::from).collect())
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Vec<String>> for Array {
|
|
||||||
fn from(v: Vec<String>) -> Self {
|
|
||||||
Array(v.into_iter().map(|x| x.into()).collect())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Vec<Vec<Value>>> for Array {
|
|
||||||
fn from(v: Vec<Vec<Value>>) -> Self {
|
|
||||||
Array(v.into_iter().map(|x| x.into()).collect())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,6 @@ impl From<&str> for Ident {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&String> for Ident {
|
|
||||||
fn from(i: &String) -> Ident {
|
|
||||||
Ident(String::from(i))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Deref for Ident {
|
impl Deref for Ident {
|
||||||
type Target = String;
|
type Target = String;
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
|
|
|
@ -45,12 +45,6 @@ impl Deref for Idiom {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<String> for Idiom {
|
|
||||||
fn from(v: String) -> Self {
|
|
||||||
Idiom(vec![Part::from(v)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Vec<Part>> for Idiom {
|
impl From<Vec<Part>> for Idiom {
|
||||||
fn from(v: Vec<Part>) -> Self {
|
fn from(v: Vec<Part>) -> Self {
|
||||||
Idiom(v)
|
Idiom(v)
|
||||||
|
|
|
@ -67,13 +67,7 @@ impl From<Graph> for Part {
|
||||||
|
|
||||||
impl From<String> for Part {
|
impl From<String> for Part {
|
||||||
fn from(v: String) -> Self {
|
fn from(v: String) -> Self {
|
||||||
Part::Field(Ident::from(v))
|
Part::Field(Ident(v))
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<&String> for Part {
|
|
||||||
fn from(v: &String) -> Self {
|
|
||||||
Part::Field(Ident::from(v))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,12 @@ impl From<String> for Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<&str> for Table {
|
||||||
|
fn from(v: &str) -> Self {
|
||||||
|
Table(String::from(v))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<Ident> for Table {
|
impl From<Ident> for Table {
|
||||||
fn from(v: Ident) -> Self {
|
fn from(v: Ident) -> Self {
|
||||||
Table(v.0)
|
Table(v.0)
|
||||||
|
|
|
@ -11,13 +11,19 @@ impl Value {
|
||||||
// Current path part is an object
|
// Current path part is an object
|
||||||
Value::Object(v) => v
|
Value::Object(v) => v
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|(k, v)| v._every(prev.clone().push(Part::from(k))))
|
.flat_map(|(k, v)| {
|
||||||
|
let p = Part::from(k.to_owned());
|
||||||
|
v._every(prev.clone().push(p))
|
||||||
|
})
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
// Current path part is an array
|
// Current path part is an array
|
||||||
Value::Array(v) => v
|
Value::Array(v) => v
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.flat_map(|(i, v)| v._every(prev.clone().push(Part::from(i))))
|
.flat_map(|(i, v)| {
|
||||||
|
let p = Part::from(i.to_owned());
|
||||||
|
v._every(prev.clone().push(p))
|
||||||
|
})
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
// Process everything else
|
// Process everything else
|
||||||
_ => vec![prev],
|
_ => vec![prev],
|
||||||
|
|
|
@ -360,12 +360,6 @@ impl From<Vec<i32>> for Value {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Vec<String>> for Value {
|
|
||||||
fn from(v: Vec<String>) -> Self {
|
|
||||||
Value::Array(Array::from(v))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<Vec<Value>> for Value {
|
impl From<Vec<Value>> for Value {
|
||||||
fn from(v: Vec<Value>) -> Self {
|
fn from(v: Vec<Value>) -> Self {
|
||||||
Value::Array(Array::from(v))
|
Value::Array(Array::from(v))
|
||||||
|
@ -378,12 +372,6 @@ impl From<Vec<Operation>> for Value {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Vec<Vec<Value>>> for Value {
|
|
||||||
fn from(v: Vec<Vec<Value>>) -> Self {
|
|
||||||
Value::Array(Array::from(v))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<HashMap<String, Value>> for Value {
|
impl From<HashMap<String, Value>> for Value {
|
||||||
fn from(v: HashMap<String, Value>) -> Self {
|
fn from(v: HashMap<String, Value>) -> Self {
|
||||||
Value::Object(Object::from(v))
|
Value::Object(Object::from(v))
|
||||||
|
|
Loading…
Reference in a new issue