From ac109a96a82fc8aa707f9a3d97b0032e5660a18d Mon Sep 17 00:00:00 2001 From: yhx-12243 Date: Tue, 1 Oct 2024 08:19:16 +0800 Subject: [PATCH] chore: new formatter --- Cargo.lock | 107 +++++++++++++++++++++++++------------------------ Cargo.toml | 10 ++--- apply_patch.py | 2 +- src/factor.rs | 4 +- src/ideal.rs | 4 +- src/main.rs | 3 +- src/qi.rs | 4 +- src/qr.rs | 2 +- 8 files changed, 69 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4310198..65d0e62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,21 +1,21 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "ahash" @@ -86,32 +86,32 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" dependencies = [ "backtrace", ] [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -126,12 +126,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "cc" -version = "1.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e8aabfac534be767c909e0690571677d49f41bd8465ae876fe043d52ba5292" - [[package]] name = "cfg-if" version = "1.0.0" @@ -146,9 +140,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "clap" -version = "4.5.15" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d8838454fda655dafd3accb2b6e2bea645b9e4078abe84a22ceb947235c5cc" +checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" dependencies = [ "clap_builder", "clap_derive", @@ -156,9 +150,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" dependencies = [ "anstream", "anstyle", @@ -171,9 +165,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", @@ -216,9 +210,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" [[package]] name = "hashbrown" @@ -251,9 +245,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "linux-raw-sys" @@ -275,11 +269,11 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] @@ -371,18 +365,27 @@ dependencies = [ [[package]] name = "object" -version = "0.36.3" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "portable-atomic" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" [[package]] name = "ppv-lite86" @@ -420,9 +423,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -466,9 +469,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags", "errno", @@ -485,18 +488,18 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "serde" -version = "1.0.206" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b3e4cd94123dd520a128bcd11e34d9e9e423e7e3e50425cb1b4b1e3549d0284" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.206" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabfb6138d2383ea8208cf98ccf69cdfb1aff4088460681d84189aa259762f97" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", @@ -505,9 +508,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.124" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66ad62847a56b3dba58cc891acd13884b9c61138d330c0d7b6181713d4fce38d" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -529,9 +532,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.74" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -559,15 +562,15 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "utf8parse" diff --git a/Cargo.toml b/Cargo.toml index 0a56a27..468c435 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,15 +9,15 @@ description = "Implementation of ideal unique factorization of quadratic integer repository = "https://github.com/yhx-12243/q" [dependencies] -anyhow = { version = "1.0.86", features = ["backtrace"] } -clap = { version = "4.5.15", features = ["derive", "unicode", "wrap_help", "env", "string", "unstable-v5"] } -clap_derive = { version = "4.5.13", features = ["unstable-v5"] } +anyhow = { version = "1.0.89", features = ["backtrace"] } +clap = { version = "4.5.18", features = ["derive", "unicode", "wrap_help", "env", "string", "unstable-v5"] } +clap_derive = { version = "4.5.18", features = ["unstable-v5"] } hashbrown = { version = "0.14.5", features = ["serde"] } nix = { version = "0.29.0", features = ["signal"] } num = { version = "0.4.3", features = ["rand"] } rand = { version = "0.8.5", features = ["log", "nightly"] } -serde = { version = "1.0.206", features = ["derive"] } -serde_json = { version = "1.0.124", features = ["float_roundtrip"] } +serde = { version = "1.0.210", features = ["derive"] } +serde_json = { version = "1.0.128", features = ["float_roundtrip"] } smallvec = { version = "1.13.2", features = ["const_new", "may_dangle", "specialization", "union"] } [lints.rust] diff --git a/apply_patch.py b/apply_patch.py index 40e9d94..573856b 100755 --- a/apply_patch.py +++ b/apply_patch.py @@ -100,7 +100,7 @@ def patch_cargo(identifier, patch, crates_io): def patch_git(identifier, patch, cargo_git): name, version = identifier.rsplit('-', 1) for d in cargo_git: - if d.name.startswith(name): + if d.name.startswith(name) and (d / version).is_dir(): return ( f'\x1b[32m======== Applying \x1b[1;35m{identifier}\x1b[32m ========\x1b[0m', patch_inner(patch, d / version), diff --git a/src/factor.rs b/src/factor.rs index 7c93ff1..a776e1c 100644 --- a/src/factor.rs +++ b/src/factor.rs @@ -1,5 +1,5 @@ use nix::{ - sys::signal::{kill, signal, SigHandler, Signal}, + sys::signal::{SigHandler, Signal, kill, signal}, unistd::Pid, }; use num::{BigUint, One}; @@ -7,8 +7,8 @@ use serde::Deserialize; use std::{ borrow::Cow, collections::{ - btree_map::Entry::{Occupied, Vacant}, BTreeMap, + btree_map::Entry::{Occupied, Vacant}, }, fs, io::{BufRead, BufReader, Write}, diff --git a/src/ideal.rs b/src/ideal.rs index 1bddcec..5d42384 100644 --- a/src/ideal.rs +++ b/src/ideal.rs @@ -1,10 +1,10 @@ use std::{cmp::Ordering, fmt::Formatter, io, str::FromStr}; use num::{ - bigint::{IntDigits, Sign}, BigInt, BigUint, Integer, One, Zero, + bigint::{IntDigits, Sign}, }; -use smallvec::{smallvec_inline, SmallVec}; +use smallvec::{SmallVec, smallvec_inline}; use crate::{discriminant, factor::factor, pell, qi::QI, qr::quadratic_residue}; diff --git a/src/main.rs b/src/main.rs index 2e6f0da..8d98070 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,6 @@ integer_sign_cast, isqrt, let_chains, - raw_ref_op, slice_ptr_get, stmt_expr_attributes, )] @@ -70,7 +69,7 @@ fn main() -> anyhow::Result<()> { ideal.reduce(); { - use core::fmt::{rt::Argument, Arguments}; + use core::fmt::{Arguments, rt::Argument}; use std::io::Write; let fmt = if plain_tex { Ideal::tex } else { Ideal::latex }; diff --git a/src/qi.rs b/src/qi.rs index 4885cab..e07cef2 100644 --- a/src/qi.rs +++ b/src/qi.rs @@ -1,6 +1,6 @@ use std::fmt::{Display, Formatter, Write}; -use num::{bigint::Sign, BigInt, BigUint, Integer, One, Signed, Zero}; +use num::{BigInt, BigUint, Integer, One, Signed, Zero, bigint::Sign}; use crate::discriminant; @@ -243,7 +243,7 @@ mod tests { use num::BigInt; - use super::{discriminant, QI}; + use super::{QI, discriminant}; fn check(qi: QI, s: &str) { let mut t = String::new(); diff --git a/src/qr.rs b/src/qr.rs index 0ba5680..86722aa 100644 --- a/src/qr.rs +++ b/src/qr.rs @@ -1,8 +1,8 @@ use std::ptr::NonNull; use num::{ - bigint::{IntDigits, RandBigInt}, BigUint, Integer, One, Zero, + bigint::{IntDigits, RandBigInt}, }; use rand::thread_rng;