Skip to content

Commit

Permalink
cargo: fix some edition 2024 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcnamara committed Jan 14, 2025
1 parent bc46a23 commit bdd9624
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
12 changes: 8 additions & 4 deletions examples/app_memory_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ pub struct Trallocator<A: GlobalAlloc>(pub A, AtomicU64);

unsafe impl<A: GlobalAlloc> GlobalAlloc for Trallocator<A> {
unsafe fn alloc(&self, l: Layout) -> *mut u8 {
self.1.fetch_add(l.size() as u64, Ordering::SeqCst);
self.0.alloc(l)
unsafe {
self.1.fetch_add(l.size() as u64, Ordering::SeqCst);
self.0.alloc(l)
}
}
unsafe fn dealloc(&self, ptr: *mut u8, l: Layout) {
self.0.dealloc(ptr, l);
self.1.fetch_sub(l.size() as u64, Ordering::SeqCst);
unsafe {
self.0.dealloc(ptr, l);
self.1.fetch_sub(l.size() as u64, Ordering::SeqCst);
}
}
}

Expand Down
7 changes: 3 additions & 4 deletions src/workbook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,10 +862,9 @@ impl Workbook {
/// src="https://rustxlsxwriter.github.io/images/workbook_worksheet_from_index.png">
///
pub fn worksheet_from_index(&mut self, index: usize) -> Result<&mut Worksheet, XlsxError> {
if let Some(worksheet) = self.worksheets.get_mut(index) {
Ok(worksheet)
} else {
Err(XlsxError::UnknownWorksheetNameOrIndex(index.to_string()))
match self.worksheets.get_mut(index) {
Some(worksheet) => Ok(worksheet),
_ => Err(XlsxError::UnknownWorksheetNameOrIndex(index.to_string())),
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#[macro_export]
macro_rules! assert_result {
( $x:expr ) => {
( $x:expr_2021 ) => {
match $x {
Ok(result) => result,
Err(e) => panic!("\n!\n! XlsxError:\n! {:?}\n!\n", e),
Expand Down

0 comments on commit bdd9624

Please sign in to comment.