Skip to content

Commit

Permalink
chore: fmt & clippy fixes for Rust 1.50 (#1004)
Browse files Browse the repository at this point in the history
* chore: fmt & clippy fixes for Rust 1.50
* update rand-core
* update googleapis (updated grpcio)

Co-authored-by: Philip Jenvey <[email protected]>
  • Loading branch information
jrconlin and pjenvey authored Feb 17, 2021
1 parent ba6e5f4 commit 56cadcb
Show file tree
Hide file tree
Showing 24 changed files with 152 additions and 159 deletions.
222 changes: 107 additions & 115 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.49-buster as builder
FROM rust:1.50-buster as builder
WORKDIR /app
ADD . /app
ENV PATH=$PATH:/root/.cargo/bin
Expand Down
9 changes: 3 additions & 6 deletions src/bin/purge_ttl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,13 @@ fn begin_transaction(
Ok((req, id))
}

fn continue_transaction(
session: &Session,
transaction_id: Vec<u8>,
) -> Result<ExecuteSqlRequest, Box<grpcio::Error>> {
fn continue_transaction(session: &Session, transaction_id: Vec<u8>) -> ExecuteSqlRequest {
let mut ts = TransactionSelector::new();
ts.set_id(transaction_id);
let mut req = ExecuteSqlRequest::new();
req.set_session(session.get_name().to_string());
req.set_transaction(ts);
Ok(req)
req
}

fn commit_transaction(
Expand Down Expand Up @@ -217,7 +214,7 @@ fn delete_incremental(
delete_sql.trim_end_matches(&", ".to_string()).to_string()
);
trace!("Deleting chunk with: {}", delete_sql);
let mut delete_req = continue_transaction(&session, txn.clone())?;
let mut delete_req = continue_transaction(&session, txn.clone());
delete_req.set_sql(delete_sql);
client.execute_sql(&delete_req)?;
info!("{}: removed {} rows", table, total);
Expand Down
5 changes: 4 additions & 1 deletion src/web/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ impl HawkError {
}

pub fn is_reportable(&self) -> bool {
matches!(&self.kind(), HawkErrorKind::TruncatedId | HawkErrorKind::Parse(_))
matches!(
&self.kind(),
HawkErrorKind::TruncatedId | HawkErrorKind::Parse(_)
)
}

pub fn metric_label(&self) -> Option<String> {
Expand Down
1 change: 1 addition & 0 deletions src/web/extractors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1616,6 +1616,7 @@ where
}

/// Deserialize a value as True if it exists, False otherwise
#[allow(clippy::unnecessary_wraps)] // serde::Deserialize requires Result<bool>
fn deserialize_present_value<'de, D>(deserializer: D) -> Result<bool, D::Error>
where
D: Deserializer<'de>,
Expand Down
4 changes: 2 additions & 2 deletions vendor/mozilla-rust-sdk/googleapis-raw/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "googleapis-raw"
version = "0.0.5"
version = "0.0.6"
authors = ["Ferrous Systems"]
edition = "2018"

[dependencies]
futures = "0.3.8"
grpcio = "0.7.1"
protobuf = "2.20.0"
protobuf = "2.22.0"

[dev-dependencies]
slog = "2.7"
Expand Down
4 changes: 2 additions & 2 deletions vendor/mozilla-rust-sdk/googleapis-raw/src/empty.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct Empty {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct SetIamPolicyRequest {
Expand Down
4 changes: 2 additions & 2 deletions vendor/mozilla-rust-sdk/googleapis-raw/src/iam/v1/policy.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct Policy {
Expand Down
2 changes: 1 addition & 1 deletion vendor/mozilla-rust-sdk/googleapis-raw/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This appears as a comment in each generated file. Add it once here
// to save a bit of time and effort.

const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

pub mod empty;
pub(crate) mod iam;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct Operation {
Expand Down
4 changes: 2 additions & 2 deletions vendor/mozilla-rust-sdk/googleapis-raw/src/rpc/code.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(Clone,PartialEq,Eq,Debug,Hash)]
pub enum Code {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct RetryInfo {
Expand Down
4 changes: 2 additions & 2 deletions vendor/mozilla-rust-sdk/googleapis-raw/src/rpc/status.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct Status {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct Database {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct InstanceConfig {
Expand Down
4 changes: 2 additions & 2 deletions vendor/mozilla-rust-sdk/googleapis-raw/src/spanner/v1/keys.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct KeyRange {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct Mutation {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct PlanNode {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct ResultSet {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct CreateSessionRequest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct TransactionOptions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is generated by rust-protobuf 2.20.0. Do not edit
// This file is generated by rust-protobuf 2.22.0. Do not edit
// @generated

// https://github.com/rust-lang/rust-clippy/issues/702
Expand All @@ -21,7 +21,7 @@
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_20_0;
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_22_0;

#[derive(PartialEq,Clone,Default)]
pub struct Type {
Expand Down
2 changes: 1 addition & 1 deletion vendor/mozilla-rust-sdk/googleapis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ futures = "0.3.8"
grpcio = "0.7.1"

[dependencies.googleapis-raw]
version = "0.0.5"
version = "0.0.6"
path = "../googleapis-raw"

0 comments on commit 56cadcb

Please sign in to comment.