Skip to content

Commit

Permalink
Fix clippy warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvc94ch committed Jun 6, 2020
1 parent a781d3d commit ca0d28c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl<T: System> EventsDecoder<T> {
}
}
}
if missing.len() > 0 {
if !missing.is_empty() {
log::warn!(
"The following primitive types do not have registered sizes: {:?} \
If any of these events are received, an error will occur since we cannot decode them",
Expand Down
6 changes: 1 addition & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,7 @@ impl<T: System + Send + Sync, S, E> ClientBuilder<T, S, E> {
let client = if let Some(client) = self.client {
client
} else {
let url = self
.url
.as_ref()
.map(|s| &**s)
.unwrap_or("ws://127.0.0.1:9944");
let url = self.url.as_deref().unwrap_or("ws://127.0.0.1:9944");
if url.starts_with("ws://") || url.starts_with("wss://") {
jsonrpsee::ws_client(url).await?
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ impl StorageMetadata {
}

pub fn default<V: Decode>(&self) -> Result<V, MetadataError> {
Decode::decode(&mut &self.default[..])
.map_err(|err| MetadataError::DefaultError(err))
Decode::decode(&mut &self.default[..]).map_err(MetadataError::DefaultError)
}

pub fn hash(hasher: &StorageHasher, bytes: &[u8]) -> Vec<u8> {
Expand Down
4 changes: 2 additions & 2 deletions src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl<T: System> Rpc<T> {
&self,
block_number: Option<BlockNumber<T>>,
) -> Result<Option<T::Hash>, Error> {
let block_number = block_number.map(|bn| ListOrValue::Value(bn));
let block_number = block_number.map(ListOrValue::Value);
let params = Params::Array(vec![to_json_value(block_number)?]);
let list_or_value = self.client.request("chain_getBlockHash", params).await?;
match list_or_value {
Expand Down Expand Up @@ -490,7 +490,7 @@ pub async fn wait_for_block_events<T: System>(
}
}
}
return if events.len() > 0 {
return if !events.is_empty() {
Ok(ExtrinsicSuccess {
block: block_hash,
extrinsic: ext_hash,
Expand Down

0 comments on commit ca0d28c

Please sign in to comment.