Skip to content

Commit

Permalink
fix: clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexD10S committed Aug 21, 2024
1 parent e9031fc commit 37cfd93
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
6 changes: 3 additions & 3 deletions crates/build/src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
//! 1. Pull the image from the registry or use the local copy if available
//! 2. Parse other arguments that were passed to the host execution context
//! 3. Calculate the digest of the command and use it
//! to uniquely identify the container
//! to uniquely identify the container
//! 4. If the container exists, we just start the build, if not, we create it
//! 5. After the build, the docker container produces metadata with
//! paths relative to its internal storage structure, we parse the file
//! and overwrite those paths relative to the host machine.
//! paths relative to its internal storage structure, we parse the file
//! and overwrite those paths relative to the host machine.

use std::{
cmp::Ordering,
Expand Down
10 changes: 3 additions & 7 deletions crates/build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,13 +727,9 @@ pub fn execute(args: ExecuteArgs) -> Result<BuildResult> {
Some(opt_passes) => *opt_passes,
None => {
let mut manifest = Manifest::new(manifest_path.clone())?;

match manifest.profile_optimization_passes() {
// if no setting is found, neither on the cli nor in the profile,
// then we use the default
None => OptimizationPasses::default(),
Some(opt_passes) => opt_passes,
}
// if no setting is found, neither on the cli nor in the profile,
// then we use the default
manifest.profile_optimization_passes().unwrap_or_default()
}
};

Expand Down
3 changes: 3 additions & 0 deletions crates/extrinsics/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,14 @@ pub struct Event {

/// Events produced from invoking a contract extrinsic.
#[derive(serde::Serialize)]
#[allow(dead_code)]
pub struct Events(Vec<Event>);

/// Displays events produced from invoking a contract extrinsic.
#[derive(serde::Serialize)]
pub struct DisplayEvents(Vec<Event>);

#[allow(clippy::needless_borrows_for_generic_args)]
impl DisplayEvents {
/// Parses events and returns an object which can be serialised
pub fn from_events<C: Config, E: Environment>(
Expand Down Expand Up @@ -331,6 +333,7 @@ impl DisplayEvents {

/// Construct the contract event data field, attempting to decode the event using the
/// [`ContractMessageTranscoder`] if available.
#[allow(clippy::needless_borrows_for_generic_args)]
fn contract_event_data_field<C: Config>(
transcoder: Option<&ContractMessageTranscoder>,
field_metadata: &scale_info::Field<PortableForm>,
Expand Down
2 changes: 1 addition & 1 deletion crates/transcode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ mod tests {

use crate::scon::Hex;

#[allow(clippy::extra_unused_lifetimes)]
#[allow(clippy::extra_unused_lifetimes, unexpected_cfgs, non_local_definitions)]
#[ink::contract]
pub mod transcode {
#[ink(storage)]
Expand Down
20 changes: 10 additions & 10 deletions crates/transcode/src/transcoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,31 +275,31 @@ mod tests {

#[test]
fn transcode_integers() -> Result<()> {
transcode_roundtrip::<i8>("-128", Value::Int(i8::min_value().into()))?;
transcode_roundtrip::<i8>("127", Value::Int(i8::max_value().into()))?;
transcode_roundtrip::<i8>("-128", Value::Int(i8::MIN.into()))?;
transcode_roundtrip::<i8>("127", Value::Int(i8::MAX.into()))?;

transcode_roundtrip::<i16>("-32768", Value::Int(i16::min_value().into()))?;
transcode_roundtrip::<i16>("32767", Value::Int(i16::max_value().into()))?;
transcode_roundtrip::<i16>("-32768", Value::Int(i16::MIN.into()))?;
transcode_roundtrip::<i16>("32767", Value::Int(i16::MAX.into()))?;

transcode_roundtrip::<i32>("-2147483648", Value::Int(i32::min_value().into()))?;
transcode_roundtrip::<i32>("2147483647", Value::Int(i32::max_value().into()))?;
transcode_roundtrip::<i32>("-2147483648", Value::Int(i32::MIN.into()))?;
transcode_roundtrip::<i32>("2147483647", Value::Int(i32::MAX.into()))?;

transcode_roundtrip::<i64>(
"-9223372036854775808",
Value::Int(i64::min_value().into()),
Value::Int(i64::MIN.into()),
)?;
transcode_roundtrip::<i64>(
"\"9_223_372_036_854_775_807\"",
Value::Int(i64::max_value().into()),
Value::Int(i64::MAX.into()),
)?;

transcode_roundtrip::<i128>(
"-170141183460469231731687303715884105728",
Value::Int(i128::min_value()),
Value::Int(i128::MIN),
)?;
transcode_roundtrip::<i128>(
"\"170141183460469231731687303715884105727\"",
Value::Int(i128::max_value()),
Value::Int(i128::MAX),
)
}

Expand Down

0 comments on commit 37cfd93

Please sign in to comment.