Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1466 from agunde406/fix-lint
Browse files Browse the repository at this point in the history
Fix lint introduced in Rust 1.63
  • Loading branch information
agunde406 committed Aug 26, 2022
2 parents ad21609 + 131fe96 commit 3431586
Show file tree
Hide file tree
Showing 100 changed files with 453 additions and 455 deletions.
10 changes: 4 additions & 6 deletions cli/src/actions/product.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,10 @@ fn determine_file_type(path: &str) -> Result<ProductFileType, CliError> {
path
))),
Some(os_str) => match os_str.to_str() {
None => {
return Err(CliError::UserError(format!(
"Unable to determine file extension: {}",
path
)))
}
None => Err(CliError::UserError(format!(
"Unable to determine file extension: {}",
path
))),
Some("yaml") | Some("yml") => Ok(ProductFileType::SchemaBasedDefinition),
Some("xml") => Ok(ProductFileType::Gdsn3_1),
Some(_) => Err(CliError::UserError(format!(
Expand Down
2 changes: 1 addition & 1 deletion cli/src/actions/xsd_downloader/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn download(url: &Url, file_name: &str) -> Result<(), CliError> {
}

/// Configuration for the caching downloader
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct CachingDownloadConfig {
pub url: Url,
pub file_path: PathBuf,
Expand Down
2 changes: 1 addition & 1 deletion cli/src/actions/xsd_downloader/extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fn copy_schemas(file: impl Read + Seek, dest_path: &Path) -> Result<(), CliError

debug!("extracting {outpath}", outpath = outpath.to_string_lossy());

if (&*file.name()).ends_with('/') {
if (file.name()).ends_with('/') {
debug!("File {} extracted to \"{}\"", i, outpath.display());
fs::create_dir_all(&outpath)
.map_err(|err| CliError::InternalError(err.to_string()))?;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/actions/xsd_downloader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const DOWNLOADS: &[UrlFile] = &[UrlFile {
}];

/// Defines how file downloads will be handled in a cached context
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum DownloadConfig {
#[cfg(feature = "xsd-downloader-force-download")]
Always,
Expand Down
4 changes: 2 additions & 2 deletions contracts/purchase_order/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ cfg_if! {
}

pub mod handler;
pub(in crate) mod payload;
pub(crate) mod payload;
pub mod permissions;
mod state;
pub(in crate) mod workflow;
pub(crate) mod workflow;

#[cfg(not(target_arch = "wasm32"))]
fn main() {
Expand Down
2 changes: 1 addition & 1 deletion daemon/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl Error for DaemonError {
}
}

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub enum ConfigurationError {
MissingValue(String),
}
Expand Down
2 changes: 1 addition & 1 deletion daemon/src/splinter/app_auth_handler/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::fmt;
use std::thread;
use std::time::Duration;

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct GetNodeError(pub String);

impl Error for GetNodeError {
Expand Down
2 changes: 1 addition & 1 deletion griddle/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub use default::DefaultPartialGriddleConfigBuilder;
pub use env::EnvPartialGriddleConfigBuilder;
pub use partial::{GriddleConfigSource, PartialGriddleConfig};

#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
/// Placeholder for indicating the scope of the requests, will be used to determine if requests
/// to Griddle should include a scope ID and what format ID to expect
pub enum Scope {
Expand Down
2 changes: 1 addition & 1 deletion griddle/src/config/partial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use crate::config::Scope;

/// Displays the source of the configuration value
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum GriddleConfigSource {
Default,
Environment,
Expand Down
2 changes: 1 addition & 1 deletion griddle/src/rest_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod error;

pub use error::GriddleRestApiServerError;

#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
/// Indicates the service scope intended for incoming requests and is used by the REST API to
/// validate requests.
pub enum Scope {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const RETRY_ATTEMPTS: u16 = 10;
// Time the submitter will wait to repoll after receiving None, in milliseconds
const POLLING_INTERVAL: u64 = 1000;

#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
// Carries the submission response from the http client back through the submitter to the observer
// Struct is publicly visible via traits associated with BatchSubmitterBuilder but not accessible
// outside the batch_submitter module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::scope_id::{GlobalScopeId, ServiceScopeId};
use super::UrlResolver;

/// A url resolver for the `GlobalScopeId`
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct GlobalUrlResolver {
base_url: String,
}
Expand All @@ -38,7 +38,7 @@ impl UrlResolver for GlobalUrlResolver {
}

/// A url resolver for the `ServiceScopeId`
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ServiceUrlResolver {
base_url: String,
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/batch_tracking/store/diesel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

pub mod models;
mod operations;
pub(in crate) mod schema;
pub(crate) mod schema;

use diesel::connection::AnsiTransactionManager;
use diesel::r2d2::{ConnectionManager, Pool};
Expand Down
14 changes: 7 additions & 7 deletions sdk/src/batch_tracking/store/diesel/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::batch_tracking::store::error::BatchTrackingStoreError;

pub const DCID_FORMAT: &str = "^dcid:[\\w\\-\\+=/~!@#\\$%\\^&\\*{}|\\[\\]<>\\?]+$";

#[derive(Identifiable, Insertable, Queryable, PartialEq, Debug, Clone)]
#[derive(Identifiable, Insertable, Queryable, PartialEq, Eq, Debug, Clone)]
#[table_name = "batches"]
#[primary_key(service_id, batch_id)]
pub struct NewBatchModel {
Expand All @@ -40,7 +40,7 @@ pub struct NewBatchModel {
pub submitted: bool,
}

#[derive(Identifiable, Insertable, Queryable, PartialEq, Debug, Clone)]
#[derive(Identifiable, Insertable, Queryable, PartialEq, Eq, Debug, Clone)]
#[table_name = "batches"]
#[primary_key(service_id, batch_id)]
pub struct BatchModel {
Expand All @@ -54,7 +54,7 @@ pub struct BatchModel {
pub created_at: i64,
}

#[derive(Identifiable, Insertable, Queryable, PartialEq, Debug, QueryableByName)]
#[derive(Identifiable, Insertable, Queryable, PartialEq, Eq, Debug, QueryableByName)]
#[table_name = "transactions"]
#[primary_key(service_id, transaction_id)]
pub struct TransactionModel {
Expand All @@ -68,7 +68,7 @@ pub struct TransactionModel {
}

#[derive(
Identifiable, Insertable, Queryable, PartialEq, Debug, AsChangeset, Clone, QueryableByName,
Identifiable, Insertable, Queryable, PartialEq, Eq, Debug, AsChangeset, Clone, QueryableByName,
)]
#[table_name = "transaction_receipts"]
#[primary_key(service_id, transaction_id)]
Expand All @@ -92,7 +92,7 @@ pub struct NewBatchStatusModel {
pub dlt_status: String,
}

#[derive(Identifiable, Insertable, Queryable, PartialEq, Debug, Clone)]
#[derive(Identifiable, Insertable, Queryable, PartialEq, Eq, Debug, Clone)]
#[table_name = "batch_statuses"]
#[primary_key(service_id, batch_id)]
pub struct BatchStatusModel {
Expand All @@ -103,7 +103,7 @@ pub struct BatchStatusModel {
pub updated_at: i64,
}

#[derive(Insertable, PartialEq, Queryable, Debug, AsChangeset)]
#[derive(Insertable, PartialEq, Eq, Queryable, Debug, AsChangeset)]
#[changeset_options(treat_none_as_null = "true")]
#[table_name = "submissions"]
pub struct NewSubmissionModel {
Expand All @@ -113,7 +113,7 @@ pub struct NewSubmissionModel {
pub error_message: Option<String>,
}

#[derive(Identifiable, Insertable, Queryable, PartialEq, Debug, QueryableByName)]
#[derive(Identifiable, Insertable, Queryable, PartialEq, Eq, Debug, QueryableByName)]
#[table_name = "submissions"]
#[primary_key(service_id, batch_id)]
pub struct SubmissionModel {
Expand Down
8 changes: 4 additions & 4 deletions sdk/src/batch_tracking/store/diesel/operations/add_batches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ impl<'a> BatchTrackingStoreAddBatchesOperation
self.conn.transaction::<_, BatchTrackingStoreError, _>(|| {
insert_into(batches::table)
.values(batch_models)
.execute(&*self.conn)
.execute(self.conn)
.map(|_| ())
.map_err(BatchTrackingStoreError::from)?;

insert_into(transactions::table)
.values(transaction_models)
.execute(&*self.conn)
.execute(self.conn)
.map(|_| ())
.map_err(BatchTrackingStoreError::from)?;

Expand All @@ -62,13 +62,13 @@ impl<'a> BatchTrackingStoreAddBatchesOperation
self.conn.transaction::<_, BatchTrackingStoreError, _>(|| {
insert_into(batches::table)
.values(batch_models)
.execute(&*self.conn)
.execute(self.conn)
.map(|_| ())
.map_err(BatchTrackingStoreError::from)?;

insert_into(transactions::table)
.values(transaction_models)
.execute(&*self.conn)
.execute(self.conn)
.map(|_| ())
.map_err(BatchTrackingStoreError::from)?;

Expand Down
20 changes: 10 additions & 10 deletions sdk/src/batch_tracking/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ use crate::error::{InternalError, InvalidArgumentError};
use crate::scope_id::{GlobalScopeId, ServiceScopeId};

#[cfg(feature = "diesel")]
pub(in crate) mod diesel;
pub(crate) mod diesel;
mod error;

pub use error::{BatchBuilderError, BatchTrackingStoreError};

const NON_SPLINTER_SERVICE_ID_DEFAULT: &str = "----";

#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum BatchStatus {
Unknown,
Pending,
Expand Down Expand Up @@ -94,7 +94,7 @@ impl fmt::Display for BatchStatusName {
}
}

#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct InvalidTransaction {
transaction_id: String,
// These are for errors from the DLT itself
Expand Down Expand Up @@ -212,7 +212,7 @@ impl InvalidTransactionBuilder {
}
}

#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ValidTransaction {
transaction_id: String,
}
Expand Down Expand Up @@ -246,7 +246,7 @@ impl ValidTransactionBuilder {
}
}

#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SubmissionError {
error_type: String,
error_message: String,
Expand Down Expand Up @@ -304,7 +304,7 @@ impl SubmissionErrorBuilder {
}
}

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct TrackingBatch {
service_id: Option<String>,
batch_header: String,
Expand Down Expand Up @@ -522,12 +522,12 @@ impl TrackingBatchBuilder {
}
}

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct TrackingBatchList {
pub batches: Vec<TrackingBatch>,
}

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct TrackingTransaction {
family_name: String,
family_version: String,
Expand Down Expand Up @@ -777,7 +777,7 @@ impl TransactionReceiptBuilder {
}
}

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct ServiceTrackingBatch {
scope_id: ServiceScopeId,
batch_header: String,
Expand Down Expand Up @@ -864,7 +864,7 @@ impl std::convert::TryFrom<TrackingBatch> for ServiceTrackingBatch {
}
}

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct GlobalTrackingBatch {
scope_id: GlobalScopeId,
batch_header: String,
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/batches/store/diesel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

pub mod models;
mod operations;
pub(in crate) mod schema;
pub(crate) mod schema;

use diesel::connection::AnsiTransactionManager;
use diesel::r2d2::{ConnectionManager, Pool};
Expand Down
6 changes: 3 additions & 3 deletions sdk/src/batches/store/diesel/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use crate::batches::store::{diesel::schema::*, Batch, BatchSubmitInfo, Transaction};
use chrono::NaiveDateTime;

#[derive(Insertable, Queryable, PartialEq, Debug)]
#[derive(Insertable, Queryable, PartialEq, Eq, Debug)]
#[table_name = "batches"]
pub struct BatchModel {
pub header_signature: String,
Expand All @@ -32,7 +32,7 @@ pub struct BatchModel {
pub service_id: Option<String>,
}

#[derive(Insertable, Queryable, PartialEq, Debug)]
#[derive(Insertable, Queryable, PartialEq, Eq, Debug)]
#[table_name = "transactions"]
pub struct TransactionModel {
pub header_signature: String,
Expand All @@ -42,7 +42,7 @@ pub struct TransactionModel {
pub signer_public_key: String,
}

#[derive(Insertable, PartialEq, Debug)]
#[derive(Insertable, PartialEq, Eq, Debug)]
#[table_name = "transaction_receipts"]
pub struct TransactionReceiptModel {
pub transaction_id: String,
Expand Down
8 changes: 4 additions & 4 deletions sdk/src/batches/store/diesel/operations/add_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ impl<'a> AddBatchOperation for BatchStoreOperations<'a, diesel::pg::PgConnection
self.conn.transaction::<_, BatchStoreError, _>(|| {
insert_into(batches::table)
.values(batch_model)
.execute(&*self.conn)
.execute(self.conn)
.map(|_| ())
.map_err(|err| {
BatchStoreError::InternalError(InternalError::from_source(Box::new(err)))
})?;

insert_into(transactions::table)
.values(transaction_models)
.execute(&*self.conn)
.execute(self.conn)
.map(|_| ())
.map_err(|err| {
BatchStoreError::InternalError(InternalError::from_source(Box::new(err)))
Expand All @@ -61,15 +61,15 @@ impl<'a> AddBatchOperation for BatchStoreOperations<'a, diesel::sqlite::SqliteCo
self.conn.transaction::<_, BatchStoreError, _>(|| {
insert_into(batches::table)
.values(batch_model)
.execute(&*self.conn)
.execute(self.conn)
.map(|_| ())
.map_err(|err| {
BatchStoreError::InternalError(InternalError::from_source(Box::new(err)))
})?;

insert_into(transactions::table)
.values(transaction_models)
.execute(&*self.conn)
.execute(self.conn)
.map(|_| ())
.map_err(|err| {
BatchStoreError::InternalError(InternalError::from_source(Box::new(err)))
Expand Down
Loading

0 comments on commit 3431586

Please sign in to comment.