Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to build with rust 1.80 #3795

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
583 changes: 301 additions & 282 deletions Cargo.lock

Large diffs are not rendered by default.

37 changes: 9 additions & 28 deletions core/tests/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ fn transaction_cut_through() {
let tx1 = tx1i2o();
let tx2 = tx2i1o();


assert!(tx1.validate(Weighting::AsTransaction).is_ok());
assert!(tx2.validate(Weighting::AsTransaction).is_ok());

Expand Down Expand Up @@ -277,17 +276,12 @@ fn multi_kernel_transaction_deaggregation() {
assert!(tx34.validate(Weighting::AsTransaction).is_ok());

let deaggregated_tx34 = deaggregate(tx1234.clone(), &[tx12.clone()]).unwrap();
assert!(deaggregated_tx34
.validate(Weighting::AsTransaction)

.is_ok());
assert!(deaggregated_tx34.validate(Weighting::AsTransaction).is_ok());
assert_eq!(tx34, deaggregated_tx34);

let deaggregated_tx12 = deaggregate(tx1234, &[tx34]).unwrap();

assert!(deaggregated_tx12
.validate(Weighting::AsTransaction)
.is_ok());
assert!(deaggregated_tx12.validate(Weighting::AsTransaction).is_ok());
assert_eq!(tx12, deaggregated_tx12);
}

Expand All @@ -309,9 +303,7 @@ fn multi_kernel_transaction_deaggregation_2() {
assert!(tx12.validate(Weighting::AsTransaction).is_ok());

let deaggregated_tx3 = deaggregate(tx123, &[tx12]).unwrap();
assert!(deaggregated_tx3
.validate(Weighting::AsTransaction)
.is_ok());
assert!(deaggregated_tx3.validate(Weighting::AsTransaction).is_ok());
assert_eq!(tx3, deaggregated_tx3);
}

Expand All @@ -334,9 +326,7 @@ fn multi_kernel_transaction_deaggregation_3() {
assert!(tx2.validate(Weighting::AsTransaction).is_ok());

let deaggregated_tx13 = deaggregate(tx123, &[tx2]).unwrap();
assert!(deaggregated_tx13
.validate(Weighting::AsTransaction)
.is_ok());
assert!(deaggregated_tx13.validate(Weighting::AsTransaction).is_ok());
assert_eq!(tx13, deaggregated_tx13);
}

Expand Down Expand Up @@ -366,9 +356,7 @@ fn multi_kernel_transaction_deaggregation_4() {
assert!(tx12345.validate(Weighting::AsTransaction).is_ok());

let deaggregated_tx5 = deaggregate(tx12345, &[tx1, tx2, tx3, tx4]).unwrap();
assert!(deaggregated_tx5
.validate(Weighting::AsTransaction)
.is_ok());
assert!(deaggregated_tx5.validate(Weighting::AsTransaction).is_ok());
assert_eq!(tx5, deaggregated_tx5);
}

Expand Down Expand Up @@ -401,9 +389,7 @@ fn multi_kernel_transaction_deaggregation_5() {
assert!(tx12345.validate(Weighting::AsTransaction).is_ok());

let deaggregated_tx5 = deaggregate(tx12345, &[tx12, tx34]).unwrap();
assert!(deaggregated_tx5
.validate(Weighting::AsTransaction)
.is_ok());
assert!(deaggregated_tx5.validate(Weighting::AsTransaction).is_ok());
assert_eq!(tx5, deaggregated_tx5);
}

Expand All @@ -424,16 +410,12 @@ fn basic_transaction_deaggregation() {

let deaggregated_tx1 = deaggregate(tx3.clone(), &[tx2.clone()]).unwrap();

assert!(deaggregated_tx1
.validate(Weighting::AsTransaction)
.is_ok());
assert!(deaggregated_tx1.validate(Weighting::AsTransaction).is_ok());
assert_eq!(tx1, deaggregated_tx1);

let deaggregated_tx2 = deaggregate(tx3, &[tx1]).unwrap();

assert!(deaggregated_tx2
.validate(Weighting::AsTransaction)
.is_ok());
assert!(deaggregated_tx2.validate(Weighting::AsTransaction).is_ok());
assert_eq!(tx2, deaggregated_tx2);
}

Expand Down Expand Up @@ -558,8 +540,7 @@ fn reward_with_tx_block() {

let tx1 = tx2i1o();
let previous_header = BlockHeader::default();
tx1.validate(Weighting::AsTransaction)
.unwrap();
tx1.validate(Weighting::AsTransaction).unwrap();

let block = new_block(&[tx1], &keychain, &builder, &previous_header, &key_id);
block.validate(&BlindingFactor::zero()).unwrap();
Expand Down
4 changes: 1 addition & 3 deletions pool/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,7 @@ where
// Otherwise discard and let the next block pick this tx up.
let bucket = &tx_buckets[pos];

if let Ok(new_bucket) =
bucket.aggregate_with_tx(entry.tx.clone(), weighting)
{
if let Ok(new_bucket) = bucket.aggregate_with_tx(entry.tx.clone(), weighting) {
if new_bucket.fee_rate >= bucket.fee_rate {
// Only aggregate if it would not reduce the fee_rate ratio.
tx_buckets[pos] = new_bucket;
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cmd/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl HTTPNodeClient {
pub fn new(node_url: &str, node_api_secret: Option<String>) -> HTTPNodeClient {
HTTPNodeClient {
node_url: node_url.to_owned(),
node_api_secret: node_api_secret,
node_api_secret,
}
}
fn send_json_request<D: serde::de::DeserializeOwned>(
Expand Down
8 changes: 4 additions & 4 deletions src/bin/tui/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn create() -> impl View {
main_menu.get_mut().add_item("Logs", VIEW_LOGS);
main_menu.get_mut().add_item("Version Info", VIEW_VERSION);
let change_view = |s: &mut Cursive, v: &&str| {
if *v == "" {
if v.is_empty() {
return;
}

Expand Down Expand Up @@ -76,12 +76,12 @@ pub fn create() -> impl View {
s.select_down(1)(c);
}
});
let main_menu = LinearLayout::new(Orientation::Vertical)

LinearLayout::new(Orientation::Vertical)
.child(ResizedView::with_full_height(main_menu))
.child(TextView::new("------------------"))
.child(TextView::new("Tab/Arrow : Cycle "))
.child(TextView::new("Enter : Select"))
.child(TextView::new("Esc : Back "))
.child(TextView::new("Q : Quit "));
main_menu
.child(TextView::new("Q : Quit "))
}
11 changes: 4 additions & 7 deletions src/bin/tui/peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl TableViewItem<PeerColumn> for PeerStats {
match column {
PeerColumn::Address => sort_by_addr(),
PeerColumn::State => self.state.cmp(&other.state).then(sort_by_addr()),
PeerColumn::UsedBandwidth => cmp_used_bandwidth(&self, &other).then(sort_by_addr()),
PeerColumn::UsedBandwidth => cmp_used_bandwidth(self, other).then(sort_by_addr()),
PeerColumn::TotalDifficulty => self
.total_difficulty
.cmp(&other.total_difficulty)
Expand Down Expand Up @@ -162,12 +162,9 @@ impl TUIPeerView {
)
.with_name(VIEW_PEER_SYNC);

let peer_status_view =
OnEventView::new(peer_status_view).on_pre_event(Key::Esc, move |c| {
let _ = c.focus_name(MAIN_MENU);
});

peer_status_view
OnEventView::new(peer_status_view).on_pre_event(Key::Esc, move |c| {
let _ = c.focus_name(MAIN_MENU);
})
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/bin/tui/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl TUIStatusView {
Cow::Owned(format!("Sync step 2/7: Downloading {}(MB) chain state for state sync: {}% at {:.1?}(kB/s)",
stat.total_size / 1_000_000,
percent,
if dur_ms > 1.0f64 { stat.downloaded_size.saturating_sub(stat.prev_downloaded_size) as f64 / dur_ms as f64 } else { 0f64 },
if dur_ms > 1.0f64 { stat.downloaded_size.saturating_sub(stat.prev_downloaded_size) as f64 / dur_ms } else { 0f64 },
))
} else {
let start = stat.start_time.timestamp_millis();
Expand Down
4 changes: 2 additions & 2 deletions src/build/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ fn main() {

if cfg!(target_os = "windows") {
Command::new("cmd")
.args(&["/C", &git_hooks])
.args(["/C", &git_hooks])
.output()
.expect("failed to execute git config for hooks");
} else {
Command::new("sh")
.args(&["-c", &git_hooks])
.args(["-c", &git_hooks])
.output()
.expect("failed to execute git config for hooks");
}
Expand Down
20 changes: 10 additions & 10 deletions util/src/zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ use zip as zip_rs;
// Sanitize file path for normal components, excluding '/', '..', and '.'
// From private function in zip crate
fn path_to_string(path: &std::path::Path) -> String {
let mut path_str = String::new();
for component in path.components() {
if let std::path::Component::Normal(os_str) = component {
if !path_str.is_empty() {
path_str.push('/');
}
path_str.push_str(&*os_str.to_string_lossy());
}
}
path_str
let mut path_str = String::new();
for component in path.components() {
if let std::path::Component::Normal(os_str) = component {
if !path_str.is_empty() {
path_str.push('/');
}
path_str.push_str(&*os_str.to_string_lossy());
}
}
path_str
}

/// Create a zip archive from source dir and list of relative file paths.
Expand Down