Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Archibald O'Accelerando committed Jan 29, 2025
1 parent 05b41ab commit dd82f69
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/analytics/offline_matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ pub async fn get_date_range_deposits_alt(
Ok(top_deposits)
}


pub async fn get_exchange_users(
pool: &Graph,
top_n: u64,
Expand Down Expand Up @@ -385,7 +384,6 @@ impl Matching {

let mut eval: Vec<AccountAddress> = vec![];
deposits.iter().for_each(|el| {

if el.deposited >= user.funded &&
// must not already have been tagged impossible
!pending.impossible.contains(&el.account) &&
Expand Down
19 changes: 9 additions & 10 deletions src/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ impl ManifestInfo {
}

/// find out the type of content in the manifest
pub fn set_contents(&mut self) -> Result<()>{
pub fn set_contents(&mut self) -> Result<()> {
// filenames may be in .gz format
let pattern = format!(
"{}/*.manifest*", // also try .gz
self.archive_dir.to_str().context("cannot parse starting dir")?
self.archive_dir
.to_str()
.context("cannot parse starting dir")?
);

if let Some(man_file) = glob(&pattern)?.flatten().next() {
Expand All @@ -77,14 +79,11 @@ impl ManifestInfo {
// first check if the v7 manifest will parse
if let Ok(_bak) = load_snapshot_manifest(&man_path) {
self.version = FrameworkVersion::V7;
} else {
if v5_read_from_snapshot_manifest(&self.archive_dir.join("state.manifest")).is_ok()
{
self.version = FrameworkVersion::V5;
}
} else if v5_read_from_snapshot_manifest(&self.archive_dir.join("state.manifest"))
.is_ok()
{
self.version = FrameworkVersion::V5;
}


}
BundleContent::Transaction => {
// TODO: v5 manifests appear to have the same format this is a noop
Expand Down Expand Up @@ -165,7 +164,7 @@ pub fn scan_dir_archive(
let archive_dir = manifest_path
.parent()
.expect("can't find manifest dir, weird");
let mut man = ManifestInfo::new(&archive_dir);
let mut man = ManifestInfo::new(archive_dir);
man.set_info()?;
archive.insert(archive_dir.to_path_buf(), man);
}
Expand Down
2 changes: 1 addition & 1 deletion src/warehouse_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl WarehouseCli {
batch_size,
} => {
info!("checking if we need to decompress");
let (archive_dir, temp) = unzip_temp::maybe_handle_gz(&archive_dir)?;
let (archive_dir, temp) = unzip_temp::maybe_handle_gz(archive_dir)?;
let mut man = ManifestInfo::new(&archive_dir);
man.set_info()?;
let pool = try_db_connection_pool(self).await?;
Expand Down
3 changes: 1 addition & 2 deletions tests/test_json_rescue_v5_load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ async fn test_rescue_v5_parse_set_wallet_tx() -> anyhow::Result<()> {
let mut result = pool.execute(cypher_query).await?;

// Fetch the first row only
let row = result.next().await?;

let _row = result.next().await?;

Ok(())
}
2 changes: 1 addition & 1 deletion tests/test_json_rescue_v5_parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn test_rescue_v5_parse_miner_tx() -> anyhow::Result<()> {
if let TransactionV5::UserTransaction(u) = &t {
if let TransactionPayload::ScriptFunction(_) = &u.raw_txn.payload {
println!("ScriptFunction");
let sf = ScriptFunctionCall::decode(&u.raw_txn.payload);
let _sf = ScriptFunctionCall::decode(&u.raw_txn.payload);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_load_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async fn test_tx_batch() -> anyhow::Result<()> {
// Fetch the first row only
let row = result.next().await?.unwrap();
let total_tx_count: i64 = row.get("total_tx_count").unwrap();
assert!(total_tx_count == 18 as i64);
assert!(total_tx_count == 18_i64);

// check there are transaction records with function args.
let cypher_query = query(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_neo4j_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async fn get_remote_neo4j() -> Result<()> {
let mut rows = g
.execute("CREATE (p: Account {name: 'hi'})\n RETURN p".into())
.await?;
let r = rows.next().await?;
let _r = rows.next().await?;

Ok(())
}
Expand Down
1 change: 0 additions & 1 deletion tests/test_scan_dirs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ fn test_scan_dir_for_v5_manifests() -> Result<()> {
Ok(())
}


#[test]
fn test_scan_dir_for_v7_manifests() -> Result<()> {
let start_here = fixtures::v7_fixtures_path();
Expand Down

0 comments on commit dd82f69

Please sign in to comment.