Merge #1114: Clippyfy rust 1.78.0
a8e256eb6b5463dfd32599618998592a94835193 clippyfy (pythcoiner)
Pull request description:
Note [this](7a11fe584a/gui/src/main.rs (L5-L6)) is related to a clippy warning that appear on MacOs (and i guess on windows)
ACKs for top commit:
edouardparis:
utACK a8e256eb6b5463dfd32599618998592a94835193
Tree-SHA512: 33d84a14718f14caf97c0a46796488cd1f3415b78efb285277afa8384b10831522a2ed15c73c9bdee4dd775ffd294ba76b146e3034d734a067c30ab25b483790
This commit is contained in:
commit
ac01a68591
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.75.0
|
toolchain: 1.78.0
|
||||||
components: rustfmt, clippy
|
components: rustfmt, clippy
|
||||||
override: true
|
override: true
|
||||||
- name: rustfmt
|
- name: rustfmt
|
||||||
@ -51,7 +51,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.76.0
|
toolchain: 1.78.0
|
||||||
components: rustfmt, clippy
|
components: rustfmt, clippy
|
||||||
override: true
|
override: true
|
||||||
- name: rustfmt
|
- name: rustfmt
|
||||||
|
|||||||
@ -32,7 +32,7 @@ impl LabelsEdited {
|
|||||||
for item in items {
|
for item in items {
|
||||||
if let Some(label) = self.0.get_mut(&item) {
|
if let Some(label) = self.0.get_mut(&item) {
|
||||||
label.valid = valid;
|
label.valid = valid;
|
||||||
label.value = value.clone();
|
label.value.clone_from(&value);
|
||||||
} else {
|
} else {
|
||||||
self.0.insert(
|
self.0.insert(
|
||||||
item,
|
item,
|
||||||
|
|||||||
@ -35,9 +35,6 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub trait Action {
|
pub trait Action {
|
||||||
fn warning(&self) -> Option<&Error> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
fn load(&self, _daemon: Arc<dyn Daemon + Sync + Send>) -> Command<Message> {
|
fn load(&self, _daemon: Arc<dyn Daemon + Sync + Send>) -> Command<Message> {
|
||||||
Command::none()
|
Command::none()
|
||||||
}
|
}
|
||||||
@ -432,10 +429,6 @@ impl SignAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Action for SignAction {
|
impl Action for SignAction {
|
||||||
fn warning(&self) -> Option<&Error> {
|
|
||||||
self.error.as_ref()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn subscription(&self) -> Subscription<Message> {
|
fn subscription(&self) -> Subscription<Message> {
|
||||||
self.hws.refresh().map(Message::HardwareWallets)
|
self.hws.refresh().map(Message::HardwareWallets)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,7 @@ impl WalletSettingsState {
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
for fingerprint in wallet.descriptor_keys().into_iter() {
|
for fingerprint in wallet.descriptor_keys().into_iter() {
|
||||||
if wallet.keys_aliases.get(&fingerprint).is_none() {
|
if !wallet.keys_aliases.contains_key(&fingerprint) {
|
||||||
keys_aliases.push((fingerprint, form::Value::default()));
|
keys_aliases.push((fingerprint, form::Value::default()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -586,7 +586,7 @@ impl Step for DefineSpend {
|
|||||||
.cloned()
|
.cloned()
|
||||||
.collect();
|
.collect();
|
||||||
if let Some((psbt, _)) = &self.generated {
|
if let Some((psbt, _)) = &self.generated {
|
||||||
draft.labels = self.coins_labels.clone();
|
draft.labels.clone_from(&self.coins_labels);
|
||||||
for (i, output) in psbt.unsigned_tx.output.iter().enumerate() {
|
for (i, output) in psbt.unsigned_tx.output.iter().enumerate() {
|
||||||
if let Some(label) = self
|
if let Some(label) = self
|
||||||
.recipients
|
.recipients
|
||||||
@ -612,11 +612,11 @@ impl Step for DefineSpend {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
draft.recipients = self.recipients.clone();
|
draft.recipients.clone_from(&self.recipients);
|
||||||
if self.recipients.len() > 1 {
|
if self.recipients.len() > 1 {
|
||||||
draft.batch_label = Some(self.batch_label.value.clone());
|
draft.batch_label = Some(self.batch_label.value.clone());
|
||||||
}
|
}
|
||||||
draft.generated = self.generated.clone();
|
draft.generated.clone_from(&self.generated);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view<'a>(&'a self, cache: &'a Cache) -> Element<'a, view::Message> {
|
fn view<'a>(&'a self, cache: &'a Cache) -> Element<'a, view::Message> {
|
||||||
@ -755,7 +755,7 @@ impl Step for SaveSpend {
|
|||||||
&self.curve,
|
&self.curve,
|
||||||
draft.network,
|
draft.network,
|
||||||
);
|
);
|
||||||
tx.labels = draft.labels.clone();
|
tx.labels.clone_from(&draft.labels);
|
||||||
|
|
||||||
if tx.is_batch() {
|
if tx.is_batch() {
|
||||||
if let Some(label) = &draft.batch_label {
|
if let Some(label) = &draft.batch_label {
|
||||||
|
|||||||
@ -175,7 +175,7 @@ impl HardwareWallets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_wallet(mut self, wallet: Arc<Wallet>) -> Self {
|
pub fn with_wallet(mut self, wallet: Arc<Wallet>) -> Self {
|
||||||
self.aliases = wallet.keys_aliases.clone();
|
self.aliases.clone_from(&wallet.keys_aliases);
|
||||||
self.wallet = Some(wallet);
|
self.wallet = Some(wallet);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|||||||
@ -770,9 +770,10 @@ impl Step for InternalBitcoindStep {
|
|||||||
fn apply(&mut self, ctx: &mut Context) -> bool {
|
fn apply(&mut self, ctx: &mut Context) -> bool {
|
||||||
// Any errors have been handled as part of `message::InternalBitcoindMsg::Start`
|
// Any errors have been handled as part of `message::InternalBitcoindMsg::Start`
|
||||||
if let Some(Ok(_)) = self.started {
|
if let Some(Ok(_)) = self.started {
|
||||||
ctx.bitcoind_config = self.bitcoind_config.clone();
|
ctx.bitcoind_config.clone_from(&self.bitcoind_config);
|
||||||
ctx.internal_bitcoind_config = self.internal_bitcoind_config.clone();
|
ctx.internal_bitcoind_config
|
||||||
ctx.internal_bitcoind = self.internal_bitcoind.clone();
|
.clone_from(&self.internal_bitcoind_config);
|
||||||
|
ctx.internal_bitcoind.clone_from(&self.internal_bitcoind);
|
||||||
self.error = None;
|
self.error = None;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -984,7 +984,7 @@ impl DescriptorEditModal for EditXpubModal {
|
|||||||
Some((key.fingerprint, key.device_kind, key.device_version.clone()));
|
Some((key.fingerprint, key.device_kind, key.device_version.clone()));
|
||||||
self.form_xpub.value = key.key.to_string();
|
self.form_xpub.value = key.key.to_string();
|
||||||
self.form_xpub.valid = true;
|
self.form_xpub.valid = true;
|
||||||
self.form_name.value = key.name.clone();
|
self.form_name.value.clone_from(&key.name);
|
||||||
self.form_name.valid = true;
|
self.form_name.valid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1394,7 +1394,7 @@ impl RegisterDescriptor {
|
|||||||
|
|
||||||
impl Step for RegisterDescriptor {
|
impl Step for RegisterDescriptor {
|
||||||
fn load_context(&mut self, ctx: &Context) {
|
fn load_context(&mut self, ctx: &Context) {
|
||||||
self.descriptor = ctx.descriptor.clone();
|
self.descriptor.clone_from(&ctx.descriptor);
|
||||||
let mut map = HashMap::new();
|
let mut map = HashMap::new();
|
||||||
for key in ctx.keys.iter().filter(|k| !k.name.is_empty()) {
|
for key in ctx.keys.iter().filter(|k| !k.name.is_empty()) {
|
||||||
map.insert(key.master_fingerprint, key.name.clone());
|
map.insert(key.master_fingerprint, key.name.clone());
|
||||||
@ -1527,7 +1527,7 @@ impl Step for BackupDescriptor {
|
|||||||
}
|
}
|
||||||
fn load_context(&mut self, ctx: &Context) {
|
fn load_context(&mut self, ctx: &Context) {
|
||||||
if self.descriptor != ctx.descriptor {
|
if self.descriptor != ctx.descriptor {
|
||||||
self.descriptor = ctx.descriptor.clone();
|
self.descriptor.clone_from(&ctx.descriptor);
|
||||||
self.done = false;
|
self.done = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,7 +91,7 @@ impl Default for Final {
|
|||||||
|
|
||||||
impl Step for Final {
|
impl Step for Final {
|
||||||
fn load_context(&mut self, ctx: &Context) {
|
fn load_context(&mut self, ctx: &Context) {
|
||||||
self.internal_bitcoind = ctx.internal_bitcoind.clone();
|
self.internal_bitcoind.clone_from(&ctx.internal_bitcoind);
|
||||||
}
|
}
|
||||||
fn load(&self) -> Command<Message> {
|
fn load(&self) -> Command<Message> {
|
||||||
if !self.generating && self.config_path.is_none() {
|
if !self.generating && self.config_path.is_none() {
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
#![windows_subsystem = "windows"]
|
#![windows_subsystem = "windows"]
|
||||||
|
|
||||||
use std::{error::Error, io::Write, path::PathBuf, process, str::FromStr};
|
|
||||||
|
|
||||||
use iced::{
|
use iced::{
|
||||||
event::{self, Event},
|
event::{self, Event},
|
||||||
executor, keyboard,
|
executor, keyboard,
|
||||||
@ -9,6 +7,7 @@ use iced::{
|
|||||||
window::settings::PlatformSpecific,
|
window::settings::PlatformSpecific,
|
||||||
Application, Command, Settings, Size, Subscription,
|
Application, Command, Settings, Size, Subscription,
|
||||||
};
|
};
|
||||||
|
use std::{error::Error, io::Write, path::PathBuf, process, str::FromStr};
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
use tracing_subscriber::filter::LevelFilter;
|
use tracing_subscriber::filter::LevelFilter;
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
|
|||||||
@ -52,7 +52,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn tag(&self) -> iced::advanced::widget::tree::Tag {
|
fn tag(&self) -> iced::advanced::widget::tree::Tag {
|
||||||
struct Marker(Vec<Instant>);
|
struct Marker(());
|
||||||
iced::advanced::widget::tree::Tag::of::<Marker>()
|
iced::advanced::widget::tree::Tag::of::<Marker>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -608,7 +608,7 @@ impl DaemonControl {
|
|||||||
let coins = db_conn.coins_by_outpoints(&outpoints);
|
let coins = db_conn.coins_by_outpoints(&outpoints);
|
||||||
if coins.len() != outpoints.len() {
|
if coins.len() != outpoints.len() {
|
||||||
for op in outpoints {
|
for op in outpoints {
|
||||||
if coins.get(&op).is_none() {
|
if !coins.contains_key(&op) {
|
||||||
return Err(CommandError::UnknownOutpoint(op));
|
return Err(CommandError::UnknownOutpoint(op));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -158,10 +158,7 @@ pub struct Config {
|
|||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn data_dir(&self) -> Option<PathBuf> {
|
pub fn data_dir(&self) -> Option<PathBuf> {
|
||||||
self.data_dir
|
self.data_dir.clone().or_else(config_folder_path)
|
||||||
.as_ref()
|
|
||||||
.map(Clone::clone)
|
|
||||||
.or_else(config_folder_path)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1116,7 +1116,7 @@ mod tests {
|
|||||||
// - Push a signature for the primary/recovery key
|
// - Push a signature for the primary/recovery key
|
||||||
// NOTE: The specific value is asserted because this was tested against a regtest
|
// NOTE: The specific value is asserted because this was tested against a regtest
|
||||||
// transaction.
|
// transaction.
|
||||||
let stack = vec![vec![0; 65], vec![0; 72]];
|
let stack = [vec![0; 65], vec![0; 72]];
|
||||||
let witness_size = bitcoin::VarInt(stack.len() as u64).size()
|
let witness_size = bitcoin::VarInt(stack.len() as u64).size()
|
||||||
+ stack
|
+ stack
|
||||||
.iter()
|
.iter()
|
||||||
@ -1126,7 +1126,7 @@ mod tests {
|
|||||||
desc.spender_input_size(true),
|
desc.spender_input_size(true),
|
||||||
32 + 4 + 1 + 4 + wu_to_vb(witness_size),
|
32 + 4 + 1 + 4 + wu_to_vb(witness_size),
|
||||||
);
|
);
|
||||||
let stack = vec![vec![0; 65], vec![0; 0], vec![0; 33], vec![0; 72]];
|
let stack = [vec![0; 65], vec![0; 0], vec![0; 33], vec![0; 72]];
|
||||||
let witness_size = bitcoin::VarInt(stack.len() as u64).size()
|
let witness_size = bitcoin::VarInt(stack.len() as u64).size()
|
||||||
+ stack
|
+ stack
|
||||||
.iter()
|
.iter()
|
||||||
|
|||||||
@ -156,7 +156,7 @@ fn list_coins(control: &DaemonControl, params: Option<Params>) -> Result<serde_j
|
|||||||
.map(|op_arg| {
|
.map(|op_arg| {
|
||||||
op_arg
|
op_arg
|
||||||
.as_str()
|
.as_str()
|
||||||
.and_then(|op| bitcoin::OutPoint::from_str(op).map_or_else(|_| None, Some))
|
.and_then(|op| bitcoin::OutPoint::from_str(op).ok())
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
Error::invalid_params(format!(
|
Error::invalid_params(format!(
|
||||||
"Invalid value {} in 'outpoints' parameter.",
|
"Invalid value {} in 'outpoints' parameter.",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user