diff --git a/.circleci/config.yml b/.circleci/config.yml index e83e632186..9a8215b898 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -160,7 +160,7 @@ commands: jobs: checks: docker: - - image: cimg/rust:1.60.0 + - image: cimg/rust:1.64.0 auth: username: $DOCKER_USER password: $DOCKER_PASS @@ -176,7 +176,7 @@ jobs: build-and-test: docker: - - image: cimg/rust:1.60.0 + - image: cimg/rust:1.64.0 auth: username: $DOCKER_USER password: $DOCKER_PASS diff --git a/Dockerfile b/Dockerfile index 0d8cf120fa..f33ae83605 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.60-buster as builder +FROM rust:1.64-buster as builder WORKDIR /app ADD . /app ENV PATH=$PATH:/root/.cargo/bin diff --git a/syncstorage-db-common/src/lib.rs b/syncstorage-db-common/src/lib.rs index 82cf4aa3bb..a850777deb 100644 --- a/syncstorage-db-common/src/lib.rs +++ b/syncstorage-db-common/src/lib.rs @@ -264,7 +264,7 @@ impl<'a> Clone for Box> { } } -#[derive(Debug, Deserialize, Clone, PartialEq, Copy)] +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Copy)] #[serde(rename_all = "lowercase")] pub enum Sorting { None, diff --git a/syncstorage-db-common/src/util.rs b/syncstorage-db-common/src/util.rs index 85f35c11dc..92da71be8d 100644 --- a/syncstorage-db-common/src/util.rs +++ b/syncstorage-db-common/src/util.rs @@ -22,7 +22,7 @@ fn ms_since_epoch() -> i64 { /// Sync Timestamp /// /// Internally represents a Sync timestamp as a u64 representing milliseconds since the epoch. -#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Deserialize, Serialize, FromSqlRow)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Deserialize, Serialize, FromSqlRow)] pub struct SyncTimestamp( #[serde(deserialize_with = "deserialize_ts", serialize_with = "serialize_ts")] u64, ); diff --git a/syncstorage/src/server/test.rs b/syncstorage/src/server/test.rs index cac9db62f2..00d12b6041 100644 --- a/syncstorage/src/server/test.rs +++ b/syncstorage/src/server/test.rs @@ -410,7 +410,7 @@ async fn post_collection() { let bytes = test_endpoint_with_body(http::Method::POST, "/1.5/42/storage/bookmarks", res_body).await; let result: PostBsos = - serde_json::from_slice(&bytes.to_vec()).expect("Could not get result in post_collection"); + serde_json::from_slice(&bytes).expect("Could not get result in post_collection"); assert!(result.modified >= start); assert_eq!(result.success.len(), 1); assert_eq!(result.failed.len(), 0); @@ -461,7 +461,7 @@ async fn bsos_can_have_a_collection_field() { {"id": "2", "collection": "foo", "payload": "SomePayload"}, ]); let bytes = test_endpoint_with_body(http::Method::POST, "/1.5/42/storage/meta", bsos).await; - let result: PostBsos = serde_json::from_slice(&bytes.to_vec()) + let result: PostBsos = serde_json::from_slice(&bytes) .expect("Could not get result in bsos_can_have_a_collection_field"); assert_eq!(result.success.len(), 2); assert_eq!(result.failed.len(), 0); diff --git a/syncstorage/src/tokenserver/auth/browserid.rs b/syncstorage/src/tokenserver/auth/browserid.rs index a6fbefa7c9..acf81dd287 100644 --- a/syncstorage/src/tokenserver/auth/browserid.rs +++ b/syncstorage/src/tokenserver/auth/browserid.rs @@ -9,7 +9,7 @@ use crate::tokenserver::settings::Settings; use std::{convert::TryFrom, time::Duration}; /// The information extracted from a valid BrowserID assertion. -#[derive(Clone, Debug, Default, Deserialize, PartialEq)] +#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq)] pub struct VerifyOutput { pub device_id: Option, pub email: String, diff --git a/syncstorage/src/tokenserver/auth/oauth.rs b/syncstorage/src/tokenserver/auth/oauth.rs index f6c1aae251..edf3e90ab4 100644 --- a/syncstorage/src/tokenserver/auth/oauth.rs +++ b/syncstorage/src/tokenserver/auth/oauth.rs @@ -16,7 +16,7 @@ use core::time::Duration; use std::convert::TryFrom; /// The information extracted from a valid OAuth token. -#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] pub struct VerifyOutput { #[serde(rename = "user")] pub fxa_uid: String, diff --git a/syncstorage/src/tokenserver/db/results.rs b/syncstorage/src/tokenserver/db/results.rs index 370b8779d0..c9fb63bbd3 100644 --- a/syncstorage/src/tokenserver/db/results.rs +++ b/syncstorage/src/tokenserver/db/results.rs @@ -25,7 +25,7 @@ pub struct GetRawUser { pub type GetUsers = Vec; -#[derive(Debug, Default, PartialEq)] +#[derive(Debug, Default, Eq, PartialEq)] pub struct AllocateUser { pub uid: i64, pub node: String, @@ -35,7 +35,7 @@ pub struct AllocateUser { /// Represents the relevant information from the most recently-created user record in the database /// for a given email and service ID, along with any previously-seen client states seen for the /// user. -#[derive(Debug, Default, PartialEq)] +#[derive(Debug, Default, Eq, PartialEq)] pub struct GetOrCreateUser { pub uid: i64, pub email: String, @@ -83,7 +83,7 @@ pub struct GetServiceId { } #[cfg(test)] -#[derive(Debug, Default, PartialEq, QueryableByName)] +#[derive(Debug, Default, Eq, PartialEq, QueryableByName)] pub struct GetUser { #[sql_type = "Integer"] #[column_name = "service"] diff --git a/syncstorage/src/tokenserver/extractors.rs b/syncstorage/src/tokenserver/extractors.rs index fa10adce62..0c21044e83 100644 --- a/syncstorage/src/tokenserver/extractors.rs +++ b/syncstorage/src/tokenserver/extractors.rs @@ -34,7 +34,7 @@ lazy_static! { const SYNC_SERVICE_NAME: &str = "sync-1.5"; /// Information from the request needed to process a Tokenserver request. -#[derive(Debug, Default, PartialEq)] +#[derive(Debug, Default, Eq, PartialEq)] pub struct TokenserverRequest { pub user: results::GetOrCreateUser, pub auth_data: AuthData, @@ -414,7 +414,7 @@ impl FromRequest for Token { } /// The data extracted from the authentication token. -#[derive(Debug, Default, PartialEq)] +#[derive(Debug, Default, Eq, PartialEq)] pub struct AuthData { pub client_state: String, pub device_id: Option, diff --git a/syncstorage/src/tokenserver/mod.rs b/syncstorage/src/tokenserver/mod.rs index c9b902baaf..9892390910 100644 --- a/syncstorage/src/tokenserver/mod.rs +++ b/syncstorage/src/tokenserver/mod.rs @@ -83,7 +83,7 @@ impl ServerState { pub struct TokenserverMetrics(Metrics); -#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)] +#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)] pub enum NodeType { #[serde(rename = "mysql")] MySql, diff --git a/syncstorage/src/web/extractors.rs b/syncstorage/src/web/extractors.rs index 00aabaa30c..9c8cfc6ee7 100644 --- a/syncstorage/src/web/extractors.rs +++ b/syncstorage/src/web/extractors.rs @@ -1179,7 +1179,7 @@ impl FromRequest for HawkIdentifier { } } -#[derive(Debug, Default, Clone, Copy, Deserialize, Validate, PartialEq)] +#[derive(Debug, Default, Clone, Copy, Deserialize, Eq, PartialEq, Validate)] #[serde(default)] pub struct Offset { pub timestamp: Option, @@ -1481,14 +1481,14 @@ impl FromRequest for BatchRequestOpt { /// both. /// /// Used with Option to extract a possible PreConditionHeader. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub enum PreConditionHeader { IfModifiedSince(SyncTimestamp), IfUnmodifiedSince(SyncTimestamp), NoHeader, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub struct PreConditionHeaderOpt { pub opt: Option, } @@ -1576,7 +1576,7 @@ impl FromRequest for PreConditionHeaderOpt { } /// Validation Error Location in the request -#[derive(Debug, Deserialize, Serialize, PartialEq)] +#[derive(Debug, Deserialize, Serialize, Eq, PartialEq)] #[serde(rename_all = "lowercase")] pub enum RequestErrorLocation { Body, @@ -1628,7 +1628,7 @@ fn validate_qs_commit(commit: &str) -> Result<(), ValidationError> { /// Verifies the BSO sortindex is in the valid range fn validate_body_bso_sortindex(sort: i32) -> Result<(), ValidationError> { - if BSO_MIN_SORTINDEX_VALUE <= sort && sort <= BSO_MAX_SORTINDEX_VALUE { + if (BSO_MIN_SORTINDEX_VALUE..=BSO_MAX_SORTINDEX_VALUE).contains(&sort) { Ok(()) } else { Err(request_error("invalid value", RequestErrorLocation::Body)) diff --git a/tokenserver-common/src/error.rs b/tokenserver-common/src/error.rs index 0d52eac89a..9784dfb5c0 100644 --- a/tokenserver-common/src/error.rs +++ b/tokenserver-common/src/error.rs @@ -156,7 +156,7 @@ impl TokenserverError { } } -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum ErrorLocation { Header, Url,