Skip to content

Fix clippy warnings, update dependencies #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 6, 2022
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
645 changes: 338 additions & 307 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ version = "0.1.0"
edition = "2018"

[dependencies]
clap = "2.33.0"
indicatif = "0.16.0"
openssl = "0.10.32"
postgres = "0.19.0"
Expand All @@ -19,7 +18,7 @@ rayon = "1.3.0"
string_cache = "0.8.0"
env_logger = "0.9.0"
log = "0.4.14"
pyo3-log = "0.4.0"
pyo3-log = "0.6.0"
log-panics = "2.0.0"

[dependencies.state-map]
Expand All @@ -29,12 +28,16 @@ git = "https://github.com/matrix-org/rust-matrix-state-map"
[lib]
crate-type = ["cdylib", "rlib"]

[dependencies.clap]
version = "3.1.14"
features = ["cargo"]

[dependencies.pyo3]
version = "0.14.1"
features = ["extension-module","abi3-py36"]
version = "0.16.4"
features = ["extension-module"]

[dependencies.tikv-jemallocator]
version = "0.4.1"
version = "0.5.0"
optional = true

[features]
Expand Down
10 changes: 5 additions & 5 deletions compressor_integration_tests/tests/compressor_config_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ fn run_succeeds_without_crashing() {
let verify = true;

let config = Config::new(
db_url.clone(),
room_id.clone(),
db_url,
room_id,
output_file,
min_state_group,
groups_to_compress,
Expand Down Expand Up @@ -525,14 +525,14 @@ fn run_is_idempotent_when_run_on_whole_room() {
.unwrap();

let config2 = Config::new(
db_url.clone(),
room_id.clone(),
db_url,
room_id,
output_file2,
min_state_group,
groups_to_compress,
min_saved_rows,
max_state_group,
level_sizes.clone(),
level_sizes,
transactions,
graphs,
commit_changes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn continue_run_called_twice_same_as_run() {

let start = Some(6);
let chunk_size = 7;
let level_info = chunk_stats_1.new_level_info.clone();
let level_info = chunk_stats_1.new_level_info;

// Run the compressor with those settings
let chunk_stats_2 = continue_run(start, chunk_size, &db_url, &room_id, &level_info).unwrap();
Expand Down
9 changes: 4 additions & 5 deletions src/compressor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,11 @@ impl<'a> Compressor<'a> {
panic!("Can only call `create_new_tree` once");
}

let pb: ProgressBar;
if cfg!(feature = "no-progress-bars") {
pb = ProgressBar::hidden();
let pb = if cfg!(feature = "no-progress-bars") {
ProgressBar::hidden()
} else {
pb = ProgressBar::new(self.original_state_map.len() as u64);
}
ProgressBar::new(self.original_state_map.len() as u64)
};
pb.set_style(
ProgressStyle::default_bar().template("[{elapsed_precise}] {bar} {pos}/{len} {msg}"),
);
Expand Down
6 changes: 1 addition & 5 deletions src/compressor/compressor_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,7 @@ fn create_new_tree_does_nothing_if_already_compressed() {
let pred_group = initial_edges.get(&i);

// Need Option<i64> not Option<&i64>
let prev;
match pred_group {
Some(i) => prev = Some(*i),
None => prev = None,
}
let prev = pred_group.copied();

// insert that edge into the initial map
initial.insert(
Expand Down
6 changes: 3 additions & 3 deletions src/compressor/level_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn get_head_returns_head() {
#[test]
fn has_space_returns_true_if_empty() {
let l = Level::new(15);
assert_eq!(l.has_space(), true);
assert!(l.has_space());
}

#[test]
Expand All @@ -65,7 +65,7 @@ fn has_space_returns_true_if_part_full() {
l.update(1, true);
l.update(143, true);
l.update(15, true);
assert_eq!(l.has_space(), true);
assert!(l.has_space());
}

#[test]
Expand All @@ -76,5 +76,5 @@ fn has_space_returns_false_if_full() {
l.update(3, true);
l.update(4, true);
l.update(5, true);
assert_eq!(l.has_space(), false);
assert!(!l.has_space());
}
6 changes: 1 addition & 5 deletions src/compressor/stats_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,7 @@ fn stats_correct_if_no_changes() {
let pred_group = initial_edges.get(&i);

// Need Option<i64> not Option<&i64>
let prev;
match pred_group {
Some(i) => prev = Some(*i),
None => prev = None,
}
let prev = pred_group.copied();

// insert that edge into the initial map
initial.insert(
Expand Down
18 changes: 8 additions & 10 deletions src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,11 @@ fn get_initial_data_from_db(
// Copy the data from the database into a map
let mut state_group_map: BTreeMap<i64, StateGroupEntry> = BTreeMap::new();

let pb: ProgressBar;
if cfg!(feature = "no-progress-bars") {
pb = ProgressBar::hidden();
let pb = if cfg!(feature = "no-progress-bars") {
ProgressBar::hidden()
} else {
pb = ProgressBar::new_spinner();
}
ProgressBar::new_spinner()
};
pb.set_style(
ProgressStyle::default_spinner().template("{spinner} [{elapsed}] {pos} rows retrieved"),
);
Expand Down Expand Up @@ -537,12 +536,11 @@ pub fn send_changes_to_db(
debug!("Writing changes...");

// setup the progress bar
let pb: ProgressBar;
if cfg!(feature = "no-progress-bars") {
pb = ProgressBar::hidden();
let pb = if cfg!(feature = "no-progress-bars") {
ProgressBar::hidden()
} else {
pb = ProgressBar::new(old_map.len() as u64);
}
ProgressBar::new(old_map.len() as u64)
};
pb.set_style(
ProgressStyle::default_bar().template("[{elapsed_precise}] {bar} {pos}/{len} {msg}"),
);
Expand Down
Loading