Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@ mod format;
mod run;
mod state;

use {
crate::{format::CodeStr, run::run},
byte_unit::Byte,
chrono::Local,
clap::{ArgAction, Parser},
env_logger::{Builder, fmt::style::Effects},
humantime::parse_duration,
log::LevelFilter,
regex::RegexSet,
std::{
env,
io::{self, IsTerminal, Write},
process::exit,
str::FromStr,
sync::{Arc, Mutex},
thread::sleep,
time::Duration,
},
use crate::{format::CodeStr, run::run};
use byte_unit::Byte;
use chrono::Local;
use clap::{ArgAction, Parser};
use env_logger::{Builder, fmt::style::Effects};
use humantime::parse_duration;
use log::LevelFilter;
use regex::RegexSet;
use std::{
env,
io::{self, IsTerminal, Write},
process::exit,
str::FromStr,
sync::{Arc, Mutex},
thread::sleep,
time::Duration,
};

#[macro_use]
Expand Down
57 changes: 26 additions & 31 deletions src/run.rs
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
use {
crate::{
Settings, Threshold,
format::CodeStr,
state::{self, State},
},
byte_unit::{Byte, UnitType},
chrono::DateTime,
regex::RegexSet,
serde::{Deserialize, Serialize},
std::{
cmp::max,
collections::{HashMap, HashSet, hash_map::Entry},
io::{self, BufRead, BufReader},
ops::Deref,
process::{Command, Stdio},
sync::{Arc, Mutex},
time::{Duration, SystemTime, UNIX_EPOCH},
},
use crate::{
Settings, Threshold,
format::CodeStr,
state::{self, State},
};
use byte_unit::{Byte, UnitType};
use chrono::DateTime;
use regex::RegexSet;
use serde::{Deserialize, Serialize};
use std::{
cmp::max,
collections::{HashMap, HashSet, hash_map::Entry},
io::{self, BufRead, BufReader},
ops::Deref,
process::{Command, Stdio},
sync::{Arc, Mutex},
time::{Duration, SystemTime, UNIX_EPOCH},
};

#[cfg(target_os = "linux")]
use {
std::path::{Path, PathBuf},
sysinfo::{Disk, Disks},
};
use std::path::{Path, PathBuf};
#[cfg(target_os = "linux")]
use sysinfo::{Disk, Disks};

// When querying Docker for the image IDs corresponding to a list of container IDs, this is the
// maximum number of container IDs to query at once.
Expand Down Expand Up @@ -931,14 +928,12 @@ pub fn run(

#[cfg(test)]
mod tests {
use {
super::{ImageNode, ImageRecord, RepositoryTag, construct_polyforest, parse_docker_date},
crate::state::{self, State},
std::{
collections::{HashMap, HashSet},
io,
time::Duration,
},
use super::{ImageNode, ImageRecord, RepositoryTag, construct_polyforest, parse_docker_date};
use crate::state::{self, State};
use std::{
collections::{HashMap, HashSet},
io,
time::Duration,
};

#[test]
Expand Down
22 changes: 10 additions & 12 deletions src/state.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
use {
crate::format::CodeStr,
serde::{Deserialize, Serialize},
std::{
collections::HashMap,
env,
fs::{create_dir_all, read_to_string},
io::{self, Write},
path::PathBuf,
time::Duration,
},
tempfile::NamedTempFile,
use crate::format::CodeStr;
use serde::{Deserialize, Serialize};
use std::{
collections::HashMap,
env,
fs::{create_dir_all, read_to_string},
io::{self, Write},
path::PathBuf,
time::Duration,
};
use tempfile::NamedTempFile;

// What we want to remember about an individual image
#[derive(Deserialize, Serialize)]
Expand Down
7 changes: 0 additions & 7 deletions toast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,6 @@ tasks:
fi
rg --type rust --files-with-matches '' src | xargs sed -i 's/_(/!(/g'

# Forbid unconsolidated `use` declarations.
if rg --line-number --type rust --multiline '}[[:space]]*;[[:space:]]*\n[[:space:]]*use' src
then
echo 'Please consolidate these `use` declarations.' >&2
exit 1
fi

# Enforce that lines span no more than 100 columns.
if rg --line-number --type rust '.{101}' src; then
echo 'There are lines spanning more than 100 columns.' >&2
Expand Down
Loading