fix: use Self when possible

pull/24376/head
Carol (Nichols || Goulding) 2021-04-16 17:19:22 -04:00
parent f136931225
commit 757933afc4
3 changed files with 8 additions and 8 deletions

View File

@ -72,7 +72,7 @@ pub(crate) trait FromFieldString {
}
impl FromFieldString for String {
fn required(self, field: impl Into<String>) -> Result<String, FieldViolation> {
fn required(self, field: impl Into<Self>) -> Result<String, FieldViolation> {
if self.is_empty() {
return Err(FieldViolation::required(field));
}

View File

@ -35,19 +35,19 @@ trait LtVal<T> {
fn lt_val(&self, v: &T) -> bool;
}
impl LtVal<f64> for f64 {
impl LtVal<Self> for f64 {
fn lt_val(&self, v: &Self) -> bool {
self < v
}
}
impl LtVal<i64> for i64 {
impl LtVal<Self> for i64 {
fn lt_val(&self, v: &Self) -> bool {
self < v
}
}
impl LtVal<bool> for bool {
impl LtVal<Self> for bool {
fn lt_val(&self, v: &Self) -> bool {
self < v
}
@ -71,19 +71,19 @@ trait ToState<T> {
fn to_state(&self) -> T;
}
impl ToState<f64> for f64 {
impl ToState<Self> for f64 {
fn to_state(&self) -> Self {
*self
}
}
impl ToState<i64> for i64 {
impl ToState<Self> for i64 {
fn to_state(&self) -> Self {
*self
}
}
impl ToState<bool> for bool {
impl ToState<Self> for bool {
fn to_state(&self) -> Self {
*self
}

View File

@ -1010,7 +1010,7 @@ impl Scalar {
}
}
impl std::ops::AddAssign<&Scalar> for Scalar {
impl std::ops::AddAssign<&Self> for Scalar {
fn add_assign(&mut self, rhs: &Self) {
if rhs.is_null() {
// Adding NULL does nothing.