GeezerVison is showing github.com — Fix future clippy warnings (#6103) · RustPython/RustPython@bfc513e
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: Cargo.toml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -138,7 +138,7 @@ members = [ | 138 | 138 | version = "0.4.0" | 139 | 139 | authors = ["RustPython Team"] | 140 | 140 | edition = "2024" | 141 | | -rust-version = "1.85.0" | | 141 | +rust-version = "1.87.0" | 142 | 142 | repository = "https://github.com/RustPython/RustPython" | 143 | 143 | license = "MIT" | 144 | 144 |
| |
Collapse file Copy file name to clipboardExpand all lines: stdlib/src/array.rs +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -851,7 +851,7 @@ mod array { | 851 | 851 | } | 852 | 852 |
| 853 | 853 | fn _from_bytes(&self, b: &[u8], itemsize: usize, vm: &VirtualMachine) -> PyResult<()> { | 854 | | - if b.len() % itemsize != 0 { | | 854 | + if !b.len().is_multiple_of(itemsize) { | 855 | 855 | return Err(vm.new_value_error("bytes length not a multiple of item size")); | 856 | 856 | } | 857 | 857 | if b.len() / itemsize > 0 { | @@ -1473,7 +1473,7 @@ mod array { | 1473 | 1473 | type Error = u8; | 1474 | 1474 |
| 1475 | 1475 | fn try_from(code: u8) -> Result<Self, Self::Error> { | 1476 | | - let big_endian = code % 2 != 0; | | 1476 | + let big_endian = !code.is_multiple_of(2); | 1477 | 1477 | let signed = match code { | 1478 | 1478 | 0 | 1 => code != 0, | 1479 | 1479 | 2..=13 => (code - 2) % 4 >= 2, | @@ -1615,7 +1615,7 @@ mod array { | 1615 | 1615 | let mut array = check_type_code(args.typecode, vm)?; | 1616 | 1616 | let format = args.mformat_code; | 1617 | 1617 | let bytes = args.items.as_bytes(); | 1618 | | - if bytes.len() % format.item_size() != 0 { | | 1618 | + if !bytes.len().is_multiple_of(format.item_size()) { | 1619 | 1619 | return Err(vm.new_value_error("bytes length not a multiple of item size")); | 1620 | 1620 | } | 1621 | 1621 | if MachineFormatCode::from_typecode(array.typecode()) == Some(format) { | |
Collapse file Copy file name to clipboardExpand all lines: stdlib/src/pystruct.rs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -171,7 +171,7 @@ pub(crate) mod _struct { | 171 | 171 | vm, | 172 | 172 | "cannot iteratively unpack with a struct of length 0".to_owned(), | 173 | 173 | )) | 174 | | - } else if buffer.len() % format_spec.size != 0 { | | 174 | + } else if !buffer.len().is_multiple_of(format_spec.size) { | 175 | 175 | Err(new_struct_error( | 176 | 176 | vm, | 177 | 177 | format!( | |
Collapse file Copy file name to clipboardExpand all lines: vm/src/builtins/memory.rs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -743,7 +743,7 @@ impl PyMemoryView { | 743 | 743 | fn cast_to_1d(&self, format: PyStrRef, vm: &VirtualMachine) -> PyResult<Self> { | 744 | 744 | let format_spec = Self::parse_format(format.as_str(), vm)?; | 745 | 745 | let itemsize = format_spec.size(); | 746 | | - if self.desc.len % itemsize != 0 { | | 746 | + if !self.desc.len.is_multiple_of(itemsize) { | 747 | 747 | return Err(vm.new_type_error("memoryview: length is not a multiple of itemsize")); | 748 | 748 | } | 749 | 749 |
| |
Collapse file Copy file name to clipboardExpand all lines: wtf8/src/core_str_count.rs +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -35,7 +35,7 @@ fn do_count_chars(s: &Wtf8) -> usize { | 35 | 35 | // Check the properties of `CHUNK_SIZE` and `UNROLL_INNER` that are required | 36 | 36 | // for correctness. | 37 | 37 | const _: () = assert!(CHUNK_SIZE < 256); | 38 | | - const _: () = assert!(CHUNK_SIZE % UNROLL_INNER == 0); | | 38 | + const _: () = assert!(CHUNK_SIZE.is_multiple_of(UNROLL_INNER)); | 39 | 39 |
| 40 | 40 | // SAFETY: transmuting `[u8]` to `[usize]` is safe except for size | 41 | 41 | // differences which are handled by `align_to`. | |
|