Fix all warnings
This commit is contained in:
parent
1e33007c4f
commit
b4ea06cc7a
@ -1,26 +1,19 @@
|
|||||||
#![feature(likely_unlikely)]
|
#![feature(likely_unlikely)]
|
||||||
#![feature(rust_cold_cc)]
|
#![feature(rust_cold_cc)]
|
||||||
|
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
mod books;
|
mod books;
|
||||||
|
|
||||||
use crate::books::FULL_BOOK_PATHS;
|
|
||||||
use core_affinity::CoreId;
|
|
||||||
use memmap2::Mmap;
|
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use std::cell::OnceCell;
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::ffi::{OsStr, OsString};
|
use std::ffi::OsStr;
|
||||||
use std::fs::{File, OpenOptions};
|
use std::fs::OpenOptions;
|
||||||
use std::hint::assert_unchecked;
|
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::mem::MaybeUninit;
|
|
||||||
use std::ops::Deref;
|
|
||||||
use std::os::linux::raw::stat;
|
|
||||||
use std::os::unix::fs::{FileExt, OpenOptionsExt};
|
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
use std::thread::available_parallelism;
|
use std::thread::available_parallelism;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use std::{array, env, fs, hint, mem, process, thread};
|
use std::{array, env, hint, process};
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_ascii_whitespace(b: u8) -> bool {
|
fn is_ascii_whitespace(b: u8) -> bool {
|
||||||
@ -368,13 +361,13 @@ fn analyze_old(file_path: &OsStr, stats: &mut Stats) {
|
|||||||
fn main() {
|
fn main() {
|
||||||
// Read in files from args
|
// Read in files from args
|
||||||
let mut files = Vec::with_capacity(env::args().len());
|
let mut files = Vec::with_capacity(env::args().len());
|
||||||
let mut do_parallel = false;
|
// let mut do_parallel = false;
|
||||||
|
|
||||||
let start_time = Instant::now();
|
let start_time = Instant::now();
|
||||||
for arg in env::args_os().skip(1) {
|
for arg in env::args_os().skip(1) {
|
||||||
// skip program arg
|
// skip program arg
|
||||||
if arg == "-p" {
|
if arg == "-p" {
|
||||||
do_parallel = true;
|
// do_parallel = true;
|
||||||
} else {
|
} else {
|
||||||
files.push(arg);
|
files.push(arg);
|
||||||
}
|
}
|
||||||
@ -389,6 +382,7 @@ fn main() {
|
|||||||
// let tab = FwTab::build();
|
// let tab = FwTab::build();
|
||||||
|
|
||||||
// Do the work
|
// Do the work
|
||||||
|
#[allow(unused_mut)] // SAFETY: We (unsafely) write to this via raw ptrs, it NEEDS to be mut!
|
||||||
let mut stats = vec![Stats {
|
let mut stats = vec![Stats {
|
||||||
sentences: 0,
|
sentences: 0,
|
||||||
words: 0,
|
words: 0,
|
||||||
@ -407,7 +401,7 @@ fn main() {
|
|||||||
// dbg!(num_cores);
|
// dbg!(num_cores);
|
||||||
|
|
||||||
rayon::ThreadPoolBuilder::new()
|
rayon::ThreadPoolBuilder::new()
|
||||||
.num_threads(num_cores)
|
.num_threads(num_threads)
|
||||||
.build_global()
|
.build_global()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user