Merge #241: Clippy fixes and version pin

f996e2565797b413870d75fa764ebd207bb264c4 ci: pin clippy to 1.65.0 for the GUI (Antoine Poinsot)
d529cd8b6c7245852deacbfa9d14b349b1ad04e3 ci: pin clippy at 1.66.0 (Antoine Poinsot)
ab9fff4395c9d368d4d8c795af4d4ada295ac36b Remove clippy.toml (Antoine Poinsot)
d3b89add9aa8d7329bbb2afc7b2288fc1ea95189 daemon: apply clippy 1.66.0 fixes (Antoine Poinsot)

Pull request description:

  The CI broke again because clippy is configured to target `stable` and introduces breaking changes with each version. Apply the fixes for the latest stable, then pin clippy to this version.

  For the GUI i wasn't sure so i just pinned clippy to the latest stable.

ACKs for top commit:
  darosior:
    self-ACK f996e2565797b413870d75fa764ebd207bb264c4 -- trivial

Tree-SHA512: 5f41af6b568e20556a4f781f3cff110790eee7f13c62842882a4211ddac9513fd84293a751b6b0fa9206cccecf06c8b04d365dd070cf26de88f4af78be1b10fc
This commit is contained in:
Antoine Poinsot 2022-12-16 11:18:15 +01:00
commit cd782f2a76
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
7 changed files with 17 additions and 22 deletions

View File

@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: 1.66.0
components: rustfmt, clippy
override: true
- name: rustfmt
@ -52,8 +52,8 @@ jobs:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
toolchain: 1.65.0
components: rustfmt, clippy
override: true
- name: rustfmt
run: cd gui && cargo fmt -- --check

View File

@ -1 +0,0 @@
msrv = "1.48"

View File

@ -234,6 +234,7 @@ impl DaemonControl {
/// Get a list of all known coins.
pub fn list_coins(&self) -> ListCoinsResult {
let mut db_conn = self.db.connection();
#[allow(clippy::iter_kv_map)] // Because Rust 1.48
let coins: Vec<ListCoinsEntry> = db_conn
.coins(CoinType::All)
// Can't use into_values as of Rust 1.48
@ -381,10 +382,7 @@ impl DaemonControl {
.ok_or(CommandError::InsufficientFunds(
in_value, out_value, feerate_vb,
))?;
let nochange_feerate_vb = absolute_fee
.to_sat()
.checked_div(nochange_vb as u64)
.unwrap();
let nochange_feerate_vb = absolute_fee.to_sat().checked_div(nochange_vb).unwrap();
if nochange_feerate_vb.checked_mul(10).unwrap() < feerate_vb.checked_mul(9).unwrap() {
return Err(CommandError::InsufficientFunds(
in_value, out_value, feerate_vb,

View File

@ -33,7 +33,7 @@ where
T: consensus::Decodable,
{
let s = String::deserialize(d)?;
let s = base64::decode(&s).map_err(de::Error::custom)?;
let s = base64::decode(s).map_err(de::Error::custom)?;
consensus::deserialize(&s).map_err(de::Error::custom)
}

View File

@ -188,7 +188,7 @@ impl Config {
let config_file =
custom_path.unwrap_or(config_file_path().ok_or(ConfigError::DatadirNotFound)?);
let config = toml::from_slice::<Config>(&std::fs::read(&config_file)?)
let config = toml::from_slice::<Config>(&std::fs::read(config_file)?)
.map_err(|e| ConfigError::ReadingFile(format!("Parsing configuration file: {}", e)))?;
config.check()?;

View File

@ -647,7 +647,7 @@ mod tests {
db.sanity_check(bitcoin::Network::Bitcoin, &options.main_descriptor)
.unwrap();
fs::remove_dir_all(&tmp_dir).unwrap();
fs::remove_dir_all(tmp_dir).unwrap();
}
#[test]
@ -675,7 +675,7 @@ mod tests {
assert_eq!(db_tip.block_hash.unwrap(), new_tip.hash);
}
fs::remove_dir_all(&tmp_dir).unwrap();
fs::remove_dir_all(tmp_dir).unwrap();
}
#[test]
@ -819,7 +819,7 @@ mod tests {
assert_eq!(coin.spend_block.unwrap().height, height);
}
fs::remove_dir_all(&tmp_dir).unwrap();
fs::remove_dir_all(tmp_dir).unwrap();
}
#[test]
@ -916,7 +916,7 @@ mod tests {
}
}
fs::remove_dir_all(&tmp_dir).unwrap();
fs::remove_dir_all(tmp_dir).unwrap();
}
#[test]
@ -1104,7 +1104,7 @@ mod tests {
assert_eq!(db_coins[&coins[4].outpoint], coin);
}
fs::remove_dir_all(&tmp_dir).unwrap();
fs::remove_dir_all(tmp_dir).unwrap();
}
#[test]
@ -1142,7 +1142,7 @@ mod tests {
assert_eq!(db_wallet.timestamp, dummy_timestamp);
}
fs::remove_dir_all(&tmp_dir).unwrap();
fs::remove_dir_all(tmp_dir).unwrap();
}
#[test]
@ -1295,6 +1295,6 @@ mod tests {
);
}
fs::remove_dir_all(&tmp_dir).unwrap();
fs::remove_dir_all(tmp_dir).unwrap();
}
}

View File

@ -105,11 +105,9 @@ fn list_confirmed(control: &DaemonControl, params: Params) -> Result<serde_json:
.and_then(|i| i.try_into().ok())
.ok_or_else(|| Error::invalid_params("Invalid 'limit' parameter."))?;
Ok(serde_json::json!(&control.list_confirmed_transactions(
start as u32,
end as u32,
limit
)))
Ok(serde_json::json!(
&control.list_confirmed_transactions(start, end, limit)
))
}
fn list_transactions(control: &DaemonControl, params: Params) -> Result<serde_json::Value, Error> {