Drop num_integer crate

This commit is contained in:
Damien Elmes 2023-06-17 00:09:41 +10:00
parent 9b028e8f3d
commit cf47e4c98d
3 changed files with 2 additions and 14 deletions

11
Cargo.lock generated
View File

@ -119,7 +119,6 @@ dependencies = [
"itertools", "itertools",
"lazy_static", "lazy_static",
"nom", "nom",
"num-integer",
"num_cpus", "num_cpus",
"num_enum", "num_enum",
"once_cell", "once_cell",
@ -2494,16 +2493,6 @@ dependencies = [
"itoa", "itoa",
] ]
[[package]]
name = "num-integer"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [
"autocfg",
"num-traits",
]
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.15" version = "0.2.15"

View File

@ -77,7 +77,6 @@ id_tree = "1.8.0"
itertools = "0.10.5" itertools = "0.10.5"
lazy_static = "1.4.0" lazy_static = "1.4.0"
nom = "7.1.3" nom = "7.1.3"
num-integer = "0.1.45"
num_cpus = "1.15.0" num_cpus = "1.15.0"
num_enum = "0.6.1" num_enum = "0.6.1"
once_cell = "1.17.1" once_cell = "1.17.1"

View File

@ -9,7 +9,6 @@ use std::collections::HashSet;
use anki_proto::notes::note_fields_check_response::State as NoteFieldsState; use anki_proto::notes::note_fields_check_response::State as NoteFieldsState;
use itertools::Itertools; use itertools::Itertools;
use num_integer::Integer;
use sha1::Digest; use sha1::Digest;
use sha1::Sha1; use sha1::Sha1;
@ -312,7 +311,8 @@ fn anki_base91(n: u64) -> String {
pub fn to_base_n(mut n: u64, table: &[u8]) -> String { pub fn to_base_n(mut n: u64, table: &[u8]) -> String {
let mut buf = String::new(); let mut buf = String::new();
while n > 0 { while n > 0 {
let (q, r) = n.div_rem(&(table.len() as u64)); let tablelen = table.len() as u64;
let (q, r) = (n / tablelen, n % tablelen);
buf.push(table[r as usize] as char); buf.push(table[r as usize] as char);
n = q; n = q;
} }