Skip to content

Commit 2efcbc9

Browse files
committed
fix build
1 parent 4f664ef commit 2efcbc9

File tree

12 files changed

+63
-57
lines changed

12 files changed

+63
-57
lines changed

src/catalyst-toolbox/catalyst-toolbox/src/ideascale/models/de/clean_string.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ impl From<String> for CleanString {
5252
}
5353
}
5454

55-
impl ToString for CleanString {
56-
fn to_string(&self) -> String {
57-
self.0.clone()
58-
}
59-
}
60-
6155
impl AsRef<str> for CleanString {
6256
fn as_ref(&self) -> &str {
6357
&self.0
6458
}
6559
}
6660

61+
impl std::fmt::Display for CleanString {
62+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
63+
write!(f, "{}", self.0)
64+
}
65+
}
66+
6767
static REGEX: Lazy<Regex> = Lazy::new(|| Regex::new("[-*/]").unwrap());
6868

6969
pub fn clean_str(s: &str) -> String {

src/chain-wallet-libs/bindings/wallet-uniffi/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#![allow(clippy::unneeded_struct_pattern)]
2+
#![allow(clippy::useless_conversion)]
3+
#![allow(unused_attributes)]
4+
15
use chain_crypto::bech32::Bech32;
26
use chain_crypto::Ed25519Extended;
37
use chain_crypto::SecretKey;
@@ -22,8 +26,6 @@ use wallet_core::Settings as InnerSettings;
2226
use wallet_core::Wallet as InnerWallet;
2327

2428
// Allow clippy warnings for generated uniffi code
25-
#[allow(clippy::unneeded_struct_pattern)]
26-
#[allow(clippy::useless_conversion)]
2729
include!(concat!(env!("OUT_DIR"), "/lib.uniffi.rs"));
2830

2931
#[derive(Debug, thiserror::Error)]

src/event-db/src/queries/search.rs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,15 @@ impl EventDB {
4848
where_clause.push_str(
4949
format!(
5050
"WHERE {0}.{1} LIKE '%{2}%'",
51-
table,
52-
filter.column,
53-
filter.search
51+
table, filter.column, filter.search
5452
)
5553
.as_str(),
5654
);
5755
for filter in filter_iter {
5856
where_clause.push_str(
5957
format!(
6058
"AND {0}.{1} LIKE '%{2}%'",
61-
table,
62-
filter.column,
63-
filter.search
59+
table, filter.column, filter.search
6460
)
6561
.as_str(),
6662
);
@@ -75,24 +71,12 @@ impl EventDB {
7571
if let Some(order_by) = order_by_iter.next() {
7672
let order_type = if order_by.descending { "DESC" } else { "ASC" };
7773
order_by_clause.push_str(
78-
format!(
79-
"ORDER BY {0}.{1} {2}",
80-
table,
81-
order_by.column,
82-
order_type
83-
)
84-
.as_str(),
74+
format!("ORDER BY {0}.{1} {2}", table, order_by.column, order_type).as_str(),
8575
);
8676
for order_by in order_by_iter {
8777
let order_type = if order_by.descending { "DESC" } else { "ASC" };
8878
order_by_clause.push_str(
89-
format!(
90-
", {0}.{1} {2}",
91-
table,
92-
order_by.column,
93-
order_type
94-
)
95-
.as_str(),
79+
format!(", {0}.{1} {2}", table, order_by.column, order_type).as_str(),
9680
);
9781
}
9882
}

src/event-db/src/types/search.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use std::fmt::Display;
21
use super::{event::EventSummary, objective::ObjectiveSummary, proposal::ProposalSummary};
2+
use std::fmt::Display;
33

44
#[derive(Debug, Clone, PartialEq, Eq)]
55
pub enum SearchTable {

src/jormungandr/testing/jormungandr-automation/src/jormungandr/grpc/server/controller.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ impl MockController {
3232
}
3333
}
3434

35-
pub fn finish_and_verify_that<F>(
36-
self,
37-
verify_func: F,
38-
) -> MockExitCode
35+
pub fn finish_and_verify_that<F>(self, verify_func: F) -> MockExitCode
3936
where
4037
F: 'static + std::marker::Send + Fn(&MockVerifier) -> bool,
4138
{

src/vit-servicing-station-f10/vit-servicing-station-server-f10/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ fn check_and_build_proper_path(path: &Path) -> std::io::Result<()> {
1717
format!("Cannot create path tree {}", path.to_str().unwrap()),
1818
)
1919
})?)?;
20-
fs::OpenOptions::new().create(true).write(true).truncate(true).open(path)?;
20+
fs::OpenOptions::new()
21+
.create(true)
22+
.write(true)
23+
.truncate(true)
24+
.open(path)?;
2125
Ok(())
2226
}
2327

src/vit-servicing-station/vit-servicing-station-server/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ fn check_and_build_proper_path(path: &Path) -> std::io::Result<()> {
2525
format!("Cannot create path tree {}", path.to_str().unwrap()),
2626
)
2727
})?)?;
28-
fs::OpenOptions::new().create(true).write(true).truncate(true).open(path)?;
28+
fs::OpenOptions::new()
29+
.create(true)
30+
.write(true)
31+
.truncate(true)
32+
.open(path)?;
2933
Ok(())
3034
}
3135

src/vit-testing/iapyx/src/load/config/servicing_station.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ pub enum RequestType {
1919

2020
#[derive(Clone, Debug, Serialize, Deserialize)]
2121
pub struct Config {
22-
pub config: HashMap<RequestType, Configuration>,
22+
pub request_configs: HashMap<RequestType, Configuration>,
2323
pub criterion: Option<u8>,
2424
pub address: String,
2525
pub use_https: bool,
2626
}
2727

2828
impl Config {
2929
pub fn get(&self, request_type: RequestType) -> Result<Configuration, Error> {
30-
self.config
30+
self.request_configs
3131
.get(&request_type)
3232
.cloned()
3333
.ok_or(Error::CannotFindConfigurationFor(request_type))

src/vit-testing/iapyx/src/load/request_generators/jormungandr/post/batch.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,19 @@ impl BatchWalletRequestGen {
121121

122122
for item in &counter {
123123
for i in item.range() {
124-
match self.proposals.iter().find(|x| {
125-
x.voteplan.chain_voteplan_id == item.id().to_string()
126-
&& (x.voteplan.chain_proposal_index % i64::from(u8::MAX)) == i as i64
127-
}) {
128-
Some(proposal) => {
129-
println!("vote on: {}/{}", proposal.voteplan.chain_voteplan_id, i);
130-
proposals.push(proposal.clone());
124+
match i64::try_from(i) {
125+
Ok(i_i64) => {
126+
if let Some(proposal) = self.proposals.iter().find(|x| {
127+
x.voteplan.chain_voteplan_id == item.id().to_string()
128+
&& (x.voteplan.chain_proposal_index % i64::from(u8::MAX)) == i_i64
129+
}) {
130+
println!("vote on: {}/{}", proposal.voteplan.chain_voteplan_id, i);
131+
proposals.push(proposal.clone());
132+
} else {
133+
return Err(MultiControllerError::NotEnoughProposals);
134+
}
131135
}
132-
None => {
136+
Err(_) => {
133137
return Err(MultiControllerError::NotEnoughProposals);
134138
}
135139
}

src/vit-testing/iapyx/src/utils/qr.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ pub fn read_qrs<P: AsRef<Path>>(
146146
let mut secrets = Vec::new();
147147
for (idx, qr) in qrs.iter().enumerate() {
148148
println!(
149-
"[{}/{}] Decoding {:?}",
149+
"[{}/{}] Decoding {}",
150150
idx + 1,
151151
qrs.len(),
152152
qr.as_ref().display()
@@ -156,7 +156,7 @@ pub fn read_qrs<P: AsRef<Path>>(
156156
Ok(pin) => pin,
157157
Err(err) => {
158158
println!(
159-
"Cannot detect pin from file: {:?}, due to {:?}",
159+
"Cannot detect pin from file: {}, due to {:?}",
160160
qr.as_ref().display(),
161161
err
162162
);
@@ -167,8 +167,8 @@ pub fn read_qrs<P: AsRef<Path>>(
167167
Ok(img) => img,
168168
Err(err) => {
169169
println!(
170-
"Cannot read qr from file: {:?}, due to {:?}",
171-
qr.as_ref(),
170+
"Cannot read qr from file: {}, due to {:?}",
171+
qr.as_ref().display(),
172172
err
173173
);
174174
continue;
@@ -184,7 +184,7 @@ pub fn read_qrs<P: AsRef<Path>>(
184184
Ok(secret) => secret,
185185
Err(err) => {
186186
println!(
187-
"Cannot decode qr from file: {:?}, due to {:?}",
187+
"Cannot decode qr from file: {}, due to {:?}",
188188
qr.as_ref().display(),
189189
err
190190
);

0 commit comments

Comments
 (0)