diff --git a/basm-macro/src/import.rs b/basm-macro/src/import.rs index 06f6946f..481b20eb 100644 --- a/basm-macro/src/import.rs +++ b/basm-macro/src/import.rs @@ -1,8 +1,8 @@ use proc_macro2::TokenStream; use quote::quote; use syn::{ - parse::{Parse, ParseStream}, Result, Signature, Token, + parse::{Parse, ParseStream}, }; use super::types::{Mangle, TFunction}; diff --git a/basm-std/src/graph.rs b/basm-std/src/graph.rs index 7dbe9e17..b23939ec 100644 --- a/basm-std/src/graph.rs +++ b/basm-std/src/graph.rs @@ -37,7 +37,7 @@ impl DfsIter for JaggedDfsIter { } fn to(&self, graph: &Self::G) -> Self::V { - graph.link[self.1 as usize].1 .0 as usize + graph.link[self.1 as usize].1.0 as usize } fn id(&self, _: &Self::G) -> Self::E { @@ -45,7 +45,7 @@ impl DfsIter for JaggedDfsIter { } fn data<'a>(&self, graph: &'a Self::G) -> &'a T { - &graph.link[self.1 as usize].1 .1 + &graph.link[self.1 as usize].1.1 } fn next(&mut self, graph: &Self::G) -> bool { diff --git a/basm-std/src/math/ntt.rs b/basm-std/src/math/ntt.rs index b6ccdb88..2e4ebbf7 100644 --- a/basm-std/src/math/ntt.rs +++ b/basm-std/src/math/ntt.rs @@ -25,10 +25,10 @@ mod test { 1614279433659886989, 2232618956921417485 ], - multiply_u64( - &[2745895686766400144, 7520886206723962441], - &[9006621652498007052, 5476023620144815056] - ) + multiply_u64(&[2745895686766400144, 7520886206723962441], &[ + 9006621652498007052, + 5476023620144815056 + ]) ); } #[test] diff --git a/basm-std/src/math/ntt/nttcore.rs b/basm-std/src/math/ntt/nttcore.rs index f370e1c3..bd65f8cf 100644 --- a/basm-std/src/math/ntt/nttcore.rs +++ b/basm-std/src/math/ntt/nttcore.rs @@ -77,11 +77,7 @@ impl Arith

{ let m = (x as u64).wrapping_mul(Self::PINV); let y = ((m as u128 * P as u128) >> 64) as u64; let (out, overflow) = ((x >> 64) as u64).overflowing_sub(y); - if overflow { - out.wrapping_add(P) - } else { - out - } + if overflow { out.wrapping_add(P) } else { out } } // Multiplication with Montgomery reduction: // a * b * R^-1 mod P @@ -145,11 +141,7 @@ impl Arith

{ // Computes a + b mod P, output range [0, 2^64) pub const fn addmod64(a: u64, b: u64) -> u64 { let (out, overflow) = a.overflowing_add(b); - if overflow { - out.wrapping_sub(P) - } else { - out - } + if overflow { out.wrapping_sub(P) } else { out } } // Computes a + b mod P, selects addmod64 or addmod depending on INV && TWIDDLE pub const fn addmodopt_invtw(a: u64, b: u64) -> u64 { @@ -162,11 +154,7 @@ impl Arith

{ // Computes a - b mod P, output range [0, P) pub const fn submod(a: u64, b: u64) -> u64 { let (out, overflow) = a.overflowing_sub(b); - if overflow { - out.wrapping_add(P) - } else { - out - } + if overflow { out.wrapping_add(P) } else { out } } } diff --git a/basm-std/src/math/pollard_rho.rs b/basm-std/src/math/pollard_rho.rs index 22ccb52e..9f7d507f 100644 --- a/basm-std/src/math/pollard_rho.rs +++ b/basm-std/src/math/pollard_rho.rs @@ -2,7 +2,7 @@ use crate::math::{ gcd, is_prime_u64, - miller_rabin::{OddMont, M}, + miller_rabin::{M, OddMont}, }; use alloc::{vec, vec::Vec}; diff --git a/basm-std/src/math/sieve.rs b/basm-std/src/math/sieve.rs index cc3e15f1..47ef7170 100644 --- a/basm-std/src/math/sieve.rs +++ b/basm-std/src/math/sieve.rs @@ -214,11 +214,7 @@ impl LinearSieve { fn next_len(cur_upto: usize, x: usize) -> usize { let out = cur_upto + (cur_upto >> 1) + 1; - if x > out { - x - } else { - out - } + if x > out { x } else { out } } } diff --git a/basm-std/src/platform/codegen.rs b/basm-std/src/platform/codegen.rs index 52450f50..0167d41e 100644 --- a/basm-std/src/platform/codegen.rs +++ b/basm-std/src/platform/codegen.rs @@ -53,7 +53,9 @@ use crate::platform::loader; compile_error!("The target architecture is not supported."); #[cfg(all(target_arch = "aarch64", feature = "submit"))] -compile_error!("AArch64 (aarch64-apple-darwin) is only supported for local execution, not submission; use x86-64 to submit."); +compile_error!( + "AArch64 (aarch64-apple-darwin) is only supported for local execution, not submission; use x86-64 to submit." +); #[cfg(all(target_arch = "x86_64", not(target_os = "windows")))] #[unsafe(no_mangle)] diff --git a/basm-std/src/platform/io/reader.rs b/basm-std/src/platform/io/reader.rs index 086f33d6..cfd150d1 100644 --- a/basm-std/src/platform/io/reader.rs +++ b/basm-std/src/platform/io/reader.rs @@ -498,11 +498,7 @@ impl ReaderTrait for Reader { let s = unsafe { core::str::from_utf8_unchecked(s_u8) }; let out = f64::from_str(s); self.skip_until_whitespace(); - if let Ok(ans) = out { - ans - } else { - f64::NAN - } + if let Ok(ans) = out { ans } else { f64::NAN } } } } diff --git a/basm-std/src/platform/malloc/dlmalloc.rs b/basm-std/src/platform/malloc/dlmalloc.rs index 9f4aa90f..5462b062 100644 --- a/basm-std/src/platform/malloc/dlmalloc.rs +++ b/basm-std/src/platform/malloc/dlmalloc.rs @@ -1847,11 +1847,7 @@ impl TreeChunk { unsafe fn leftmost_child(me: *mut TreeChunk) -> *mut TreeChunk { unsafe { let left = (*me).child[0]; - if left.is_null() { - (*me).child[1] - } else { - left - } + if left.is_null() { (*me).child[1] } else { left } } } diff --git a/basm-std/src/utils/f64.rs b/basm-std/src/utils/f64.rs index c29511de..bcc0adf2 100644 --- a/basm-std/src/utils/f64.rs +++ b/basm-std/src/utils/f64.rs @@ -339,11 +339,7 @@ impl F64Ops for f64 { #[inline] fn rem_euclid(self, rhs: f64) -> f64 { let r = self % rhs; - if r < 0.0 { - r + rhs.abs() - } else { - r - } + if r < 0.0 { r + rhs.abs() } else { r } } /// Raises a number to an integer power. @@ -377,11 +373,7 @@ impl F64Ops for f64 { powx *= powx; m /= 2; } - if n < 0 { - 1.0 / r - } else { - r - } + if n < 0 { 1.0 / r } else { r } } /// Raises a number to a floating point power. diff --git a/basm/build.rs b/basm/build.rs index 4c299747..8ecae357 100644 --- a/basm/build.rs +++ b/basm/build.rs @@ -34,8 +34,10 @@ fn main() { let stdout = String::from_utf8_lossy(&output.stdout); let stdout = stdout.trim(); if !stdout.contains("x86_64-w64-mingw32-gcc") { - panic!("Failed to locate MinGW64 (x86_64-w64-mingw32-gcc).\n{0}", - "Please make sure MinGW64 is installed and added in the PATH environment variable."); + panic!( + "Failed to locate MinGW64 (x86_64-w64-mingw32-gcc).\n{0}", + "Please make sure MinGW64 is installed and added in the PATH environment variable." + ); } link_args_basm.push("-nostartfiles"); link_args_basm.push("-nostdlib");