diff --git a/Makefile b/Makefile index 8ab1b255..9177e0ef 100644 --- a/Makefile +++ b/Makefile @@ -166,11 +166,5 @@ test: RUST_BACKTRACE=full cargo test --release publish-crates: build - cargo publish -p rio-window - cargo publish -p sugarloaf - cargo publish -p rio-proc-macros - cargo publish -p copa - cargo publish -p corcovado - cargo publish -p teletypewriter - cargo publish -p rio-backend - cargo publish -p rioterm + # Note: cargo publish is only supported from >=1.90 + cargo publish --workspace diff --git a/rio-backend/src/crosswords/mod.rs b/rio-backend/src/crosswords/mod.rs index 6d654cdb..046810e9 100644 --- a/rio-backend/src/crosswords/mod.rs +++ b/rio-backend/src/crosswords/mod.rs @@ -353,7 +353,7 @@ impl TabStops { fn resize(&mut self, columns: usize) { let mut index = self.tabs.len(); self.tabs.resize_with(columns, || { - let is_tabstop = index % INITIAL_TABSTOPS == 0; + let is_tabstop = index.is_multiple_of(INITIAL_TABSTOPS); index += 1; is_tabstop }); diff --git a/rio-backend/src/performer/handler.rs b/rio-backend/src/performer/handler.rs index bce09c88..4f6df760 100644 --- a/rio-backend/src/performer/handler.rs +++ b/rio-backend/src/performer/handler.rs @@ -768,7 +768,7 @@ impl copa::Perform for Performer<'_, U, T> { // Set color index. b"4" => { - if params.len() <= 1 || params.len() % 2 == 0 { + if params.len() <= 1 || params.len().is_multiple_of(2) { unhandled(params); return; } @@ -1339,7 +1339,7 @@ fn process_xtgettcap_request(buffer: &[u8]) -> String { /// Decode hex-encoded string (2 hex digits per character). fn decode_hex_string(hex_bytes: &[u8]) -> Result { - if hex_bytes.len() % 2 != 0 { + if !hex_bytes.len().is_multiple_of(2) { return Err("Invalid hex string length"); } diff --git a/rio-window/src/cursor.rs b/rio-window/src/cursor.rs index 08f09778..74ed738f 100644 --- a/rio-window/src/cursor.rs +++ b/rio-window/src/cursor.rs @@ -236,7 +236,7 @@ impl CursorImage { return Err(BadImage::TooLarge { width, height }); } - if rgba.len() % PIXEL_SIZE != 0 { + if !rgba.len().is_multiple_of(PIXEL_SIZE) { return Err(BadImage::ByteCountNotDivisibleBy4 { byte_count: rgba.len(), }); diff --git a/rio-window/src/icon.rs b/rio-window/src/icon.rs index 0aa9fbf0..4194f5bd 100644 --- a/rio-window/src/icon.rs +++ b/rio-window/src/icon.rs @@ -75,7 +75,7 @@ mod constructors { width: u32, height: u32, ) -> Result { - if rgba.len() % PIXEL_SIZE != 0 { + if !rgba.len().is_multiple_of(PIXEL_SIZE) { return Err(BadIcon::ByteCountNotDivisibleBy4 { byte_count: rgba.len(), }); diff --git a/sugarloaf/src/components/rich_text/text_run_manager.rs b/sugarloaf/src/components/rich_text/text_run_manager.rs index 086fbe98..0242cbee 100644 --- a/sugarloaf/src/components/rich_text/text_run_manager.rs +++ b/sugarloaf/src/components/rich_text/text_run_manager.rs @@ -112,7 +112,7 @@ impl TextRunManager { // layers: [i32; 2] = 8 bytes const VERTEX_SIZE: usize = 44; - if vertices_data.len() % VERTEX_SIZE != 0 { + if !vertices_data.len().is_multiple_of(VERTEX_SIZE) { debug!("Invalid vertex data size: {}", vertices_data.len()); output_vertices.extend_from_slice(vertices_data); return; diff --git a/sugarloaf/src/font_introspector/text/compose.rs b/sugarloaf/src/font_introspector/text/compose.rs index d6953a69..75ecf771 100644 --- a/sugarloaf/src/font_introspector/text/compose.rs +++ b/sugarloaf/src/font_introspector/text/compose.rs @@ -118,7 +118,7 @@ fn compose_hangul(a: char, b: char) -> Option { return None; } if a >= SBASE { - if (a - SBASE) % TCOUNT == 0 { + if (a - SBASE).is_multiple_of(TCOUNT) { Some(unsafe { from_u32_unchecked(a + (b - TBASE)) }) } else { None