зеркало из https://github.com/mozilla/glean.git
Родитель
3832b01658
Коммит
b149f7f3ee
|
@ -178,9 +178,9 @@ pub fn set_experiment_active(
|
|||
extra: Option<HashMap<String, String>>,
|
||||
) {
|
||||
glean_core::glean_set_experiment_active(
|
||||
experiment_id.to_owned(),
|
||||
branch.to_owned(),
|
||||
extra.unwrap_or_else(HashMap::new),
|
||||
experiment_id,
|
||||
branch,
|
||||
extra.unwrap_or_default(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ pub fn set_experiment_active(
|
|||
///
|
||||
/// See [`glean_core::Glean::set_experiment_inactive`].
|
||||
pub fn set_experiment_inactive(experiment_id: String) {
|
||||
glean_core::glean_set_experiment_inactive(experiment_id.to_owned())
|
||||
glean_core::glean_set_experiment_inactive(experiment_id)
|
||||
}
|
||||
|
||||
/// Performs the collection/cleanup operations required by becoming active.
|
||||
|
|
|
@ -41,11 +41,10 @@ impl PingType {
|
|||
reason_codes,
|
||||
);
|
||||
|
||||
let me = Self {
|
||||
Self {
|
||||
inner,
|
||||
test_callback: Arc::new(Default::default()),
|
||||
};
|
||||
me
|
||||
}
|
||||
}
|
||||
|
||||
/// Submits the ping for eventual uploading.
|
||||
|
|
|
@ -564,7 +564,7 @@ fn core_metrics_should_be_cleared_and_restored_when_disabling_and_enabling_uploa
|
|||
// No app_channel reported.
|
||||
test_reset_glean(
|
||||
Configuration {
|
||||
data_path: tmpname.clone(),
|
||||
data_path: tmpname,
|
||||
application_id: GLOBAL_APPLICATION_ID.into(),
|
||||
upload_enabled: true,
|
||||
max_events: None,
|
||||
|
|
|
@ -234,7 +234,7 @@ fn validate_source_tags(tags: &Vec<String>) -> bool {
|
|||
return false;
|
||||
}
|
||||
|
||||
tags.iter().all(|x| validate_tag(x))
|
||||
tags.iter().all(validate_tag)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -107,7 +107,7 @@ fn limits_on_experiments_extras_are_applied_correctly() {
|
|||
// Get the data
|
||||
let experiment_data = glean.test_get_experiment_data(experiment_id);
|
||||
assert!(
|
||||
!experiment_data.is_none(),
|
||||
experiment_data.is_some(),
|
||||
"Experiment data must be available"
|
||||
);
|
||||
|
||||
|
|
|
@ -286,8 +286,7 @@ pub fn combine_base_identifier_and_label(base_identifer: &str, label: &str) -> S
|
|||
|
||||
/// Strips the label off of a complete identifier
|
||||
pub fn strip_label(identifier: &str) -> &str {
|
||||
// safe unwrap, first field of a split always valid
|
||||
identifier.splitn(2, '/').next().unwrap()
|
||||
identifier.split_once('/').map_or(identifier, |s| s.0)
|
||||
}
|
||||
|
||||
/// Validates a dynamic label, changing it to `OTHER_LABEL` if it's invalid.
|
||||
|
|
|
@ -156,7 +156,7 @@ impl PingType {
|
|||
glean
|
||||
.additional_metrics
|
||||
.pings_submitted
|
||||
.get(ping.name.to_string())
|
||||
.get(ping.name)
|
||||
.add_sync(glean, 1);
|
||||
|
||||
if let Err(e) = ping_maker.store_ping(glean.get_data_path(), &ping) {
|
||||
|
|
|
@ -206,7 +206,7 @@ impl StorageManager {
|
|||
let mut snapshotter = |metric_id: &[u8], metric: &Metric| {
|
||||
let metric_id = String::from_utf8_lossy(metric_id).into_owned();
|
||||
if metric_id.ends_with("#experiment") {
|
||||
let name = metric_id.splitn(2, '#').next().unwrap(); // safe unwrap, first field of a split always valid
|
||||
let (name, _) = metric_id.split_once('#').unwrap(); // safe unwrap, we ensured there's a `#` in the string
|
||||
snapshot.insert(name.to_string(), metric.as_json());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -171,7 +171,7 @@ impl PingDirectoryManager {
|
|||
if let (Some(Ok(path)), Some(Ok(body)), Ok(metadata)) =
|
||||
(lines.next(), lines.next(), lines.next().transpose())
|
||||
{
|
||||
let headers = metadata.map(|m| process_metadata(&path, &m)).flatten();
|
||||
let headers = metadata.and_then(|m| process_metadata(&path, &m));
|
||||
return Some((document_id.into(), path, body, headers));
|
||||
} else {
|
||||
log::warn!(
|
||||
|
|
|
@ -662,7 +662,7 @@ impl PingUploadManager {
|
|||
let metric = self
|
||||
.upload_metrics
|
||||
.ping_upload_failure
|
||||
.get(label.to_string());
|
||||
.get(label);
|
||||
metric.add_sync(glean, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ fn stopping_non_existing_id_records_an_error() {
|
|||
&glean,
|
||||
metric.meta(),
|
||||
ErrorType::InvalidState,
|
||||
Some("store1".into())
|
||||
Some("store1")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ fn the_accumulate_raw_samples_api_correctly_stores_timing_values() {
|
|||
let seconds_to_nanos = 1000 * 1000 * 1000;
|
||||
metric.accumulate_raw_samples_nanos_sync(
|
||||
&glean,
|
||||
&[seconds_to_nanos, 2 * seconds_to_nanos, 3 * seconds_to_nanos].to_vec(),
|
||||
[seconds_to_nanos, 2 * seconds_to_nanos, 3 * seconds_to_nanos].as_ref(),
|
||||
);
|
||||
|
||||
let snapshot = metric
|
||||
|
@ -381,7 +381,7 @@ fn the_accumulate_raw_samples_api_correctly_stores_timing_values() {
|
|||
&glean,
|
||||
metric.meta(),
|
||||
ErrorType::InvalidState,
|
||||
Some("store1".into())
|
||||
Some("store1")
|
||||
)
|
||||
.is_err());
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче