Skip to content

Commit

Permalink
Merge pull request #1881 from CosmWasm/fixing-clippy-warnings-and-spe…
Browse files Browse the repository at this point in the history
…llings

Fixed clippy warnings and spelling
  • Loading branch information
DariuszDepta authored Sep 19, 2023
2 parents 1d89751 + 4a2d720 commit 6d3f9b0
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 114 deletions.
10 changes: 5 additions & 5 deletions packages/go-gen/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ pub fn schema_object_type(
pub fn nullable_type(subschemas: &[Schema]) -> Result<Option<&SchemaObject>, anyhow::Error> {
let (found_null, nullable_type): (bool, Option<&SchemaObject>) = subschemas
.iter()
.fold(Ok((false, None)), |result: Result<_>, subschema| {
result.and_then(|(nullable, not_null)| {
.try_fold(
(false, None),
|(nullable, not_null), subschema| -> Result<_> {
let subschema = subschema.object()?;
if is_null(subschema) {
Ok((true, not_null))
} else {
Ok((nullable, Some(subschema)))
}
})
})
},
)
.context("failed to get anyOf subschemas")?;

Ok(if found_null { nullable_type } else { None })
}

Expand Down
6 changes: 3 additions & 3 deletions packages/std/src/addresses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl<'a> From<&'a Addr> for Cow<'a, Addr> {
///
/// The safe way to obtain a valid `CanonicalAddr` is using `Api::addr_canonicalize`. In
/// addition to that there are many unsafe ways to convert any binary data into an instance.
/// So the type shoud be treated as a marker to express the intended data type, not as
/// So the type should be treated as a marker to express the intended data type, not as
/// a validity guarantee of any sort.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Hash, JsonSchema)]
pub struct CanonicalAddr(pub Binary);
Expand Down Expand Up @@ -358,7 +358,7 @@ pub fn instantiate2_address(
}

/// The instantiate2 address derivation implementation. This API is used for
/// testing puposes only. The `msg` field is discouraged and should not be used.
/// testing purposes only. The `msg` field is discouraged and should not be used.
/// Use [`instantiate2_address`].
#[doc(hidden)]
fn instantiate2_address_impl(
Expand Down Expand Up @@ -751,7 +751,7 @@ mod tests {
}

#[test]
fn instantiate2_address_impl_works_for_cosmjs_testvectors() {
fn instantiate2_address_impl_works_for_cosmjs_test_vectors() {
// Test data from https://github.com/cosmos/cosmjs/pull/1253
const COSMOS_ED25519_TESTS_JSON: &str = "./testdata/instantiate2_addresses.json";

Expand Down
2 changes: 1 addition & 1 deletion packages/std/src/errors/system_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::Binary;
///
/// This is used on return values for Querier as a nested result: Result<StdResult<T>, SystemError>
/// The first wrap (SystemError) will trigger if the contract address doesn't exist,
/// the QueryRequest is malformated, etc. The second wrap will be an error message from
/// the QueryRequest is malformed, etc. The second wrap will be an error message from
/// the contract itself.
///
/// Such errors are only created by the VM. The error type is defined in the standard library, to ensure
Expand Down
6 changes: 3 additions & 3 deletions packages/std/src/testing/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ const CANONICAL_LENGTH: usize = 90; // n = 45
const SHUFFLES_ENCODE: usize = 10;
const SHUFFLES_DECODE: usize = 2;

// MockPrecompiles zero pads all human addresses to make them fit the canonical_length
// MockApi zero pads all human addresses to make them fit the canonical_length
// it trims off zeros for the reverse operation.
// not really smart, but allows us to see a difference (and consistent length for canonical adddresses)
// not really smart, but allows us to see a difference (and consistent length for canonical addresses)
#[derive(Copy, Clone)]
pub struct MockApi {
/// Length of canonical addresses created with this API. Contracts should not make any assumptions
Expand Down Expand Up @@ -152,7 +152,7 @@ impl Api for MockApi {
));
}

// mimicks formats like hex or bech32 where different casings are valid for one address
// mimics formats like hex or bech32 where different casings are valid for one address
let normalized = input.to_lowercase();

let mut out = Vec::from(normalized);
Expand Down
1 change: 0 additions & 1 deletion packages/vm/benches/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ pub fn bench_instance_threads(c: &mut Criterion) {
let checksum = random_checksum();

thread::spawn(move || {
let checksum = checksum;
// Perform measurement internally
let t = SystemTime::now();
black_box(
Expand Down
1 change: 0 additions & 1 deletion packages/vm/examples/multi_threaded_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ pub fn main() {
let cache = Arc::clone(&cache);

threads.push(thread::spawn(move || {
let checksum = checksum;
let mut instance = cache
.get_instance(&checksum, mock_backend(&[]), DEFAULT_INSTANCE_OPTIONS)
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ impl<A: BackendApi, S: Storage, Q: Querier> Environment<A, S, Q> {

/// Creates a MemoryView.
/// This must be short living and not be used after the memory was grown.
pub fn memory<'a>(&self, store: &'a mut impl AsStoreMut) -> MemoryView<'a> {
pub fn memory<'a>(&self, store: &'a impl AsStoreMut) -> MemoryView<'a> {
self.memory
.as_ref()
.expect("Memory is not set. This is a bug in the lifecycle.")
Expand Down
Loading

0 comments on commit 6d3f9b0

Please sign in to comment.