Skip to content

Commit

Permalink
Fix clippy (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshidan authored Dec 9, 2024
1 parent d142e0c commit 5b57214
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion foundation/metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub async fn email(service_account: &str) -> Result<String, Error> {

async fn get_etag_with_trim(suffix: &str) -> Result<String, Error> {
let result = get_etag(suffix).await?;
return Ok(result.trim().to_string());
Ok(result.trim().to_string())
}

async fn get_etag(suffix: &str) -> Result<String, Error> {
Expand Down
2 changes: 1 addition & 1 deletion spanner-derive/src/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) struct Column<'a> {
pub commit_timestamp: bool,
}

impl<'a> Column<'a> {
impl Column<'_> {
pub(crate) fn name(&self) -> String {
match &self.column_name {
Some(v) => v.to_string(),
Expand Down
4 changes: 2 additions & 2 deletions spanner-derive/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl PartialEq<Symbol> for Ident {
}
}

impl<'a> PartialEq<Symbol> for &'a Ident {
impl PartialEq<Symbol> for &Ident {
fn eq(&self, word: &Symbol) -> bool {
*self == word.0
}
Expand All @@ -28,7 +28,7 @@ impl PartialEq<Symbol> for Path {
}
}

impl<'a> PartialEq<Symbol> for &'a Path {
impl PartialEq<Symbol> for &Path {
fn eq(&self, word: &Symbol) -> bool {
self.is_ident(word.0)
}
Expand Down
4 changes: 2 additions & 2 deletions spanner/src/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ where
}

pub fn as_ref<'a>(item: &'a Value, field: &'a Field) -> Result<&'a Kind, Error> {
return match item.kind.as_ref() {
match item.kind.as_ref() {
Some(v) => Ok(v),
None => Err(Error::NoKind(field.name.to_string())),
};
}
}

pub fn kind_to_error<'a, T>(v: &'a value::Kind, field: &'a Field) -> Result<T, Error> {
Expand Down
2 changes: 1 addition & 1 deletion spanner/src/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ where
}
}

impl<'a, T> ToKind for &'a [T]
impl<T> ToKind for &[T]
where
T: ToKind,
{
Expand Down
4 changes: 2 additions & 2 deletions spanner/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,11 @@ impl Transaction {
}

pub(crate) fn get_session_name(&self) -> String {
return self.session.as_ref().unwrap().session.name.to_string();
self.session.as_ref().unwrap().session.name.to_string()
}

pub(crate) fn as_mut_session(&mut self) -> &mut ManagedSession {
return self.session.as_mut().unwrap();
self.session.as_mut().unwrap()
}

/// returns the owner ship of session.
Expand Down
6 changes: 3 additions & 3 deletions spanner/src/transaction_rw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ impl ReadWriteTransaction {
{
let opt = options.unwrap_or_default();

return match result {
match result {
Ok(s) => match self.commit(opt).await {
Ok(c) => Ok((c.commit_timestamp.map(|ts| ts.into()), s)),
// Retry the transaction using the same session on ABORT error.
Expand All @@ -293,11 +293,11 @@ impl ReadWriteTransaction {
Code::Aborted => Err((err, self.take_session())),
_ => {
let _ = self.rollback(opt.call_options.retry).await;
return Err((err, self.take_session()));
Err((err, self.take_session()))
}
}
}
};
}
}

pub(crate) async fn commit(&mut self, options: CommitOptions) -> Result<CommitResponse, Status> {
Expand Down
5 changes: 2 additions & 3 deletions storage/src/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,12 @@ fn v4_sanitize_headers(hdrs: &[String]) -> Vec<String> {
}

fn extract_header_names(kvs: &[String]) -> Vec<&str> {
return kvs
.iter()
kvs.iter()
.map(|header| {
let name_value: Vec<&str> = header.split(':').collect();
name_value[0]
})
.collect();
.collect()
}

fn validate_options(opts: &SignedURLOptions) -> Result<(), SignedURLError> {
Expand Down

0 comments on commit 5b57214

Please sign in to comment.