зеркало из https://github.com/mozilla/glean.git
Fix clippy issues
This commit is contained in:
Родитель
1f2bb48dfe
Коммит
3f2e8f6427
2
Makefile
2
Makefile
|
@ -12,7 +12,7 @@ emulator:
|
|||
.PHONY: install
|
||||
|
||||
lint: fmt
|
||||
cargo clippy --all
|
||||
cargo clippy --all --all-targets --all-features -- -D warnings
|
||||
./gradlew ktlint detekt
|
||||
.PHONY: lint
|
||||
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
use glean_core::Glean;
|
||||
|
||||
// #[allow(dead_code)] is required on functions in this module as a workaround
|
||||
// for https://github.com/rust-lang/rust/issues/46379
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn tempdir() -> (tempfile::TempDir, String) {
|
||||
let t = tempfile::tempdir().unwrap();
|
||||
let name = t.path().display().to_string();
|
||||
|
@ -14,6 +18,7 @@ pub const GLOBAL_APPLICATION_ID: &str = "org.mozilla.glean.test.app";
|
|||
|
||||
// Create a new instance of Glean with a temporary directory.
|
||||
// We need to keep the `TempDir` alive, so that it's not deleted before we stop using it.
|
||||
#[allow(dead_code)]
|
||||
pub fn new_glean() -> (Glean, tempfile::TempDir) {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let tmpname = dir.path().display().to_string();
|
||||
|
|
|
@ -31,7 +31,7 @@ fn counter_serializer_should_correctly_serialize_counters() {
|
|||
metric.add(&glean, 1);
|
||||
|
||||
let snapshot = StorageManager
|
||||
.snapshot_as_json(glean.storage(), "store1".into(), true)
|
||||
.snapshot_as_json(glean.storage(), "store1", true)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
json!({"counter": {"telemetry.counter_metric": 1}}),
|
||||
|
@ -44,7 +44,7 @@ fn counter_serializer_should_correctly_serialize_counters() {
|
|||
{
|
||||
let glean = Glean::new(&tmpname, GLOBAL_APPLICATION_ID).unwrap();
|
||||
let snapshot = StorageManager
|
||||
.snapshot_as_json(glean.storage(), "store1".into(), true)
|
||||
.snapshot_as_json(glean.storage(), "store1", true)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
json!({"counter": {"telemetry.counter_metric": 1}}),
|
||||
|
@ -105,7 +105,7 @@ fn snapshot_correctly_clears_the_stores() {
|
|||
|
||||
// Get the snapshot from "store1" and clear it.
|
||||
let snapshot = StorageManager.snapshot(glean.storage(), "store1", true);
|
||||
assert!(snapshot.unwrap().len() != 0);
|
||||
assert!(!snapshot.unwrap().is_empty());
|
||||
// Check that getting a new snapshot for "store1" returns an empty store.
|
||||
assert!(StorageManager
|
||||
.snapshot(glean.storage(), "store1", false)
|
||||
|
@ -113,7 +113,7 @@ fn snapshot_correctly_clears_the_stores() {
|
|||
// Check that we get the right data from both the stores. Clearing "store1" must
|
||||
// not clear "store2" as well.
|
||||
let snapshot2 = StorageManager.snapshot(glean.storage(), "store2", true);
|
||||
assert!(snapshot2.unwrap().len() != 0);
|
||||
assert!(!snapshot2.unwrap().is_empty());
|
||||
}
|
||||
|
||||
// SKIPPED from glean-ac: counters are serialized in the correct JSON format
|
||||
|
|
Загрузка…
Ссылка в новой задаче