Skip to content

Commit 6b1ec5c

Browse files
authored
Merge pull request #1632 from TheBlueMatt/2022-07-warnings
Fix compilation warnings
2 parents 36bffb5 + 4da6f23 commit 6b1ec5c

File tree

2 files changed

+7
-33
lines changed

2 files changed

+7
-33
lines changed

lightning-invoice/src/payment.rs

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,8 +1437,6 @@ mod tests {
14371437
enum TestResult {
14381438
PaymentFailure { path: Vec<RouteHop>, short_channel_id: u64 },
14391439
PaymentSuccess { path: Vec<RouteHop> },
1440-
ProbeFailure { path: Vec<RouteHop>, short_channel_id: u64 },
1441-
ProbeSuccess { path: Vec<RouteHop> },
14421440
}
14431441

14441442
impl TestScorer {
@@ -1474,12 +1472,6 @@ mod tests {
14741472
Some(TestResult::PaymentSuccess { path }) => {
14751473
panic!("Unexpected successful payment path: {:?}", path)
14761474
},
1477-
Some(TestResult::ProbeFailure { path, .. }) => {
1478-
panic!("Unexpected failed payment probe: {:?}", path)
1479-
},
1480-
Some(TestResult::ProbeSuccess { path }) => {
1481-
panic!("Unexpected successful payment probe: {:?}", path)
1482-
},
14831475
None => panic!("Unexpected payment_path_failed call: {:?}", actual_path),
14841476
}
14851477
}
@@ -1494,18 +1486,12 @@ mod tests {
14941486
Some(TestResult::PaymentSuccess { path }) => {
14951487
assert_eq!(actual_path, &path.iter().collect::<Vec<_>>()[..]);
14961488
},
1497-
Some(TestResult::ProbeFailure { path, .. }) => {
1498-
panic!("Unexpected failed payment probe: {:?}", path)
1499-
},
1500-
Some(TestResult::ProbeSuccess { path }) => {
1501-
panic!("Unexpected successful payment probe: {:?}", path)
1502-
},
15031489
None => panic!("Unexpected payment_path_successful call: {:?}", actual_path),
15041490
}
15051491
}
15061492
}
15071493

1508-
fn probe_failed(&mut self, actual_path: &[&RouteHop], actual_short_channel_id: u64) {
1494+
fn probe_failed(&mut self, actual_path: &[&RouteHop], _: u64) {
15091495
if let Some(expectations) = &mut self.expectations {
15101496
match expectations.pop_front() {
15111497
Some(TestResult::PaymentFailure { path, .. }) => {
@@ -1514,13 +1500,6 @@ mod tests {
15141500
Some(TestResult::PaymentSuccess { path }) => {
15151501
panic!("Unexpected successful payment path: {:?}", path)
15161502
},
1517-
Some(TestResult::ProbeFailure { path, short_channel_id }) => {
1518-
assert_eq!(actual_path, &path.iter().collect::<Vec<_>>()[..]);
1519-
assert_eq!(actual_short_channel_id, short_channel_id);
1520-
},
1521-
Some(TestResult::ProbeSuccess { path }) => {
1522-
panic!("Unexpected successful payment probe: {:?}", path)
1523-
},
15241503
None => panic!("Unexpected payment_path_failed call: {:?}", actual_path),
15251504
}
15261505
}
@@ -1534,12 +1513,6 @@ mod tests {
15341513
Some(TestResult::PaymentSuccess { path }) => {
15351514
panic!("Unexpected successful payment path: {:?}", path)
15361515
},
1537-
Some(TestResult::ProbeFailure { path, .. }) => {
1538-
panic!("Unexpected failed payment probe: {:?}", path)
1539-
},
1540-
Some(TestResult::ProbeSuccess { path }) => {
1541-
assert_eq!(actual_path, &path.iter().collect::<Vec<_>>()[..]);
1542-
},
15431516
None => panic!("Unexpected payment_path_successful call: {:?}", actual_path),
15441517
}
15451518
}

lightning/src/debug_sync.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ struct LockMetadata {
6868

6969
struct LockDep {
7070
lock: Arc<LockMetadata>,
71-
lockdep_trace: Backtrace,
71+
/// lockdep_trace is unused unless we're building with `backtrace`, so we mark it _
72+
_lockdep_trace: Backtrace,
7273
}
7374

7475
#[cfg(feature = "backtrace")]
@@ -140,21 +141,21 @@ impl LockMetadata {
140141
// of the same lock.
141142
debug_assert!(cfg!(feature = "backtrace"), "Tried to acquire a lock while it was held!");
142143
}
143-
for (locked_dep_idx, locked_dep) in locked.locked_before.lock().unwrap().iter() {
144+
for (locked_dep_idx, _locked_dep) in locked.locked_before.lock().unwrap().iter() {
144145
if *locked_dep_idx == this.lock_idx && *locked_dep_idx != locked.lock_idx {
145146
#[cfg(feature = "backtrace")]
146147
panic!("Tried to violate existing lockorder.\nMutex that should be locked after the current lock was created at the following backtrace.\nNote that to get a backtrace for the lockorder violation, you should set RUST_BACKTRACE=1\nLock being taken constructed at: {} ({}):\n{:?}\nLock constructed at: {} ({})\n{:?}\n\nLock dep created at:\n{:?}\n\n",
147148
get_construction_location(&this._lock_construction_bt), this.lock_idx, this._lock_construction_bt,
148149
get_construction_location(&locked._lock_construction_bt), locked.lock_idx, locked._lock_construction_bt,
149-
locked_dep.lockdep_trace);
150+
_locked_dep._lockdep_trace);
150151
#[cfg(not(feature = "backtrace"))]
151152
panic!("Tried to violate existing lockorder. Build with the backtrace feature for more info.");
152153
}
153154
}
154155
// Insert any already-held locks in our locked-before set.
155156
let mut locked_before = this.locked_before.lock().unwrap();
156157
if !locked_before.contains_key(&locked.lock_idx) {
157-
let lockdep = LockDep { lock: Arc::clone(locked), lockdep_trace: Backtrace::new() };
158+
let lockdep = LockDep { lock: Arc::clone(locked), _lockdep_trace: Backtrace::new() };
158159
locked_before.insert(lockdep.lock.lock_idx, lockdep);
159160
}
160161
}
@@ -175,7 +176,7 @@ impl LockMetadata {
175176
let mut locked_before = this.locked_before.lock().unwrap();
176177
for (locked_idx, locked) in held.borrow().iter() {
177178
if !locked_before.contains_key(locked_idx) {
178-
let lockdep = LockDep { lock: Arc::clone(locked), lockdep_trace: Backtrace::new() };
179+
let lockdep = LockDep { lock: Arc::clone(locked), _lockdep_trace: Backtrace::new() };
179180
locked_before.insert(*locked_idx, lockdep);
180181
}
181182
}

0 commit comments

Comments
 (0)