Skip to content

Commit

Permalink
chore: new formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
yhx-12243 committed Oct 1, 2024
1 parent 09b0967 commit ac109a9
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 67 deletions.
107 changes: 55 additions & 52 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion apply_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions src/factor.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use nix::{
sys::signal::{kill, signal, SigHandler, Signal},
sys::signal::{SigHandler, Signal, kill, signal},
unistd::Pid,
};
use num::{BigUint, One};
use serde::Deserialize;
use std::{
borrow::Cow,
collections::{
btree_map::Entry::{Occupied, Vacant},
BTreeMap,
btree_map::Entry::{Occupied, Vacant},
},
fs,
io::{BufRead, BufReader, Write},
Expand Down
4 changes: 2 additions & 2 deletions src/ideal.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
integer_sign_cast,
isqrt,
let_chains,
raw_ref_op,
slice_ptr_get,
stmt_expr_attributes,
)]
Expand Down Expand Up @@ -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 };
Expand Down
4 changes: 2 additions & 2 deletions src/qi.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/qr.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::ptr::NonNull;

use num::{
bigint::{IntDigits, RandBigInt},
BigUint, Integer, One, Zero,
bigint::{IntDigits, RandBigInt},
};
use rand::thread_rng;

Expand Down

0 comments on commit ac109a9

Please sign in to comment.