Fix all warnings

This commit is contained in:
Jan Katzer 2025-10-06 13:45:18 +02:00
parent f3ec3fdd36
commit 9028293a85

View File

@ -1,26 +1,19 @@
#![feature(likely_unlikely)]
#![feature(rust_cold_cc)]
#![allow(dead_code)]
mod books;
use crate::books::FULL_BOOK_PATHS;
use core_affinity::CoreId;
use memmap2::Mmap;
use rayon::prelude::*;
use std::cell::OnceCell;
use std::cell::RefCell;
use std::ffi::{OsStr, OsString};
use std::fs::{File, OpenOptions};
use std::hint::assert_unchecked;
use std::ffi::OsStr;
use std::fs::OpenOptions;
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::thread::available_parallelism;
use std::time::{Duration, Instant};
use std::{array, env, fs, hint, mem, process, thread};
use std::{array, env, hint, process};
#[inline]
fn is_ascii_whitespace(b: u8) -> bool {
@ -368,13 +361,13 @@ fn analyze_old(file_path: &OsStr, stats: &mut Stats) {
fn main() {
// Read in files from args
let mut files = Vec::with_capacity(env::args().len());
let mut do_parallel = false;
// let mut do_parallel = false;
let start_time = Instant::now();
for arg in env::args_os().skip(1) {
// skip program arg
if arg == "-p" {
do_parallel = true;
// do_parallel = true;
} else {
files.push(arg);
}
@ -389,6 +382,7 @@ fn main() {
// let tab = FwTab::build();
// 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 {
sentences: 0,
words: 0,
@ -407,7 +401,7 @@ fn main() {
// dbg!(num_cores);
rayon::ThreadPoolBuilder::new()
.num_threads(num_cores)
.num_threads(num_threads)
.build_global()
.unwrap();