Update rust to 1.60.0 and min rust to 1.59.0 (#4904)

This commit is contained in:
Mark Hammond 2022-04-27 14:52:39 +10:00 коммит произвёл GitHub
Родитель 9cf7b7c965
Коммит 6e17d9154a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
12 изменённых файлов: 49 добавлений и 45 удалений

Просмотреть файл

@ -3,7 +3,7 @@ version: 2.1
# ⚠️ If you add, rename or delete a job here, please also update .mergify.yml! ⚠️
commands:
# Our policy for updating rust versions is at https://github.com/mozilla/application-services/tree/main/docs/rust-versions.md
# Our policy for updating rust versions is at https://github.com/mozilla/application-services/tree/main/docs/design/rust-versions.md
# See also rust-toolchain in the root of this repo, which is used to specify our official target version.
setup-rust-target-version:
steps:
@ -13,7 +13,7 @@ commands:
setup-rust-min-version:
steps:
# https://searchfox.org/mozilla-central/source/python/mozboot/mozboot/util.py#20
- run: rustup override set 1.57.0
- run: rustup override set 1.59.0
full-checkout:
steps:

Просмотреть файл

@ -99,7 +99,6 @@ pub(crate) fn get_credit_card(conn: &Connection, guid: &Guid) -> Result<Internal
}
pub(crate) fn get_all_credit_cards(conn: &Connection) -> Result<Vec<InternalCreditCard>> {
let credit_cards;
let sql = format!(
"SELECT
{common_cols},
@ -109,7 +108,7 @@ pub(crate) fn get_all_credit_cards(conn: &Connection) -> Result<Vec<InternalCred
);
let mut stmt = conn.prepare(&sql)?;
credit_cards = stmt
let credit_cards = stmt
.query_map([], InternalCreditCard::from_row)?
.collect::<std::result::Result<Vec<InternalCreditCard>, _>>()?;
Ok(credit_cards)

Просмотреть файл

@ -2,16 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use crate::client::{http_client::*, SettingsClient};
use crate::{
Branch, BucketConfig, FeatureConfig, RandomizationUnit, Experiment,
error::{NimbusError}, RemoteSettingsConfig, SCHEMA_VERSION,
};
use crate::client::{
SettingsClient, http_client::*,
error::NimbusError, Branch, BucketConfig, Experiment, FeatureConfig, RandomizationUnit,
RemoteSettingsConfig, SCHEMA_VERSION,
};
use mockito::mock;
use std::time::{Duration, Instant};
use std::cell::Cell;
use std::time::{Duration, Instant};
#[test]
fn test_fetch_experiments_from_schema() {

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Allow this to run in "safe mode"
// Allow this to run in "safe mode"
#![allow(unused_imports)]
use crate::error::Result;
@ -25,4 +25,4 @@ fn test_null_client() -> Result<()> {
let experiments = client.get_all_experiments()?;
assert_eq!(experiments.len(), 0);
Ok(())
}
}

Просмотреть файл

@ -6,7 +6,7 @@
use crate::{error::Result, Defaults, NimbusError::InternalError};
use serde_json::{json, Value};
use std::{array::IntoIter, collections::HashMap};
use std::collections::HashMap;
#[cfg(test)]
impl Defaults for &str {
@ -55,26 +55,31 @@ fn test_defaults_optional() -> Result<()> {
#[test]
fn test_defaults_hashmap() -> Result<()> {
let a = HashMap::<String, &str>::from_iter(IntoIter::new([
("a".to_string(), "A from a"),
("b".to_string(), "B from a"),
]));
let a = HashMap::<String, &str>::from_iter(
[("a".to_string(), "A from a"), ("b".to_string(), "B from a")].into_iter(),
);
let b = HashMap::<String, &str>::from_iter(IntoIter::new([
("a".to_string(), "AA not replaced"),
("b".to_string(), "errBB merge failed, so omitting"),
("c".to_string(), "CC added"),
("d".to_string(), "errDD not merged, but added"),
]));
let b = HashMap::<String, &str>::from_iter(
[
("a".to_string(), "AA not replaced"),
("b".to_string(), "errBB merge failed, so omitting"),
("c".to_string(), "CC added"),
("d".to_string(), "errDD not merged, but added"),
]
.into_iter(),
);
let exp = HashMap::<String, &str>::from_iter(IntoIter::new([
("a".to_string(), "A from a"),
// we tried to merge the defaults, but it failed, so we
// we keep the original (i.e. the experiment rather than the rollout)
("b".to_string(), "B from a"),
("c".to_string(), "CC added"),
("d".to_string(), "errDD not merged, but added"),
]));
let exp = HashMap::<String, &str>::from_iter(
[
("a".to_string(), "A from a"),
// we tried to merge the defaults, but it failed, so we
// we keep the original (i.e. the experiment rather than the rollout)
("b".to_string(), "B from a"),
("c".to_string(), "CC added"),
("d".to_string(), "errDD not merged, but added"),
]
.into_iter(),
);
assert_eq!(a.defaults(&b)?, exp);

Просмотреть файл

@ -159,7 +159,7 @@ pub fn split_after_host_and_port(href: &str) -> (&str, &str) {
let (_, remainder) = split_after_prefix(href);
let hp_definite_end =
memchr::memchr3(b'/', b'?', b'#', remainder.as_bytes()).unwrap_or_else(|| remainder.len());
memchr::memchr3(b'/', b'?', b'#', remainder.as_bytes()).unwrap_or(remainder.len());
let (before_hp, after_hp) = remainder.split_at(hp_definite_end);

Просмотреть файл

@ -2118,7 +2118,7 @@ mod tests {
}
(true, false) => {
assert!(
!fetch_visits(&db, &url, 0)?.is_some(),
fetch_visits(&db, &url, 0)?.is_none(),
"Should delete synced page"
);
assert!(
@ -2147,7 +2147,7 @@ mod tests {
);
}
(false, false) => {
assert!(!fetch_visits(&db, &url, 0)?.is_some(), "Should delete page");
assert!(fetch_visits(&db, &url, 0)?.is_none(), "Should delete page");
assert!(
!page_has_tombstone(&db, &info.guid)?,
"Shouldn't insert tombstone for page"

Просмотреть файл

@ -1370,7 +1370,7 @@ mod tests {
// query by title
let meta = query(&conn, "child care", 10).expect("query should work");
assert_eq!(1, meta.len(), "expected exactly one result");
assert_history_metadata_record!(&meta[0],
assert_history_metadata_record!(meta[0],
url "https://www.cbc.ca/news/politics/federal-budget-2021-freeland-zimonjic-1.5991021",
total_time 20000,
search_term Some("cbc federal budget 2021"),
@ -1383,7 +1383,7 @@ mod tests {
// query by search term
let meta = query(&conn, "string format", 10).expect("query should work");
assert_eq!(1, meta.len(), "expected exactly one result");
assert_history_metadata_record!(&meta[0],
assert_history_metadata_record!(meta[0],
url "https://stackoverflow.com/questions/37777675/how-to-create-a-formatted-string-out-of-a-literal-in-rust",
total_time 20000,
search_term Some("rust string format"),
@ -1395,7 +1395,7 @@ mod tests {
// query by url
let meta = query(&conn, "instr", 10).expect("query should work");
assert_history_metadata_record!(&meta[0],
assert_history_metadata_record!(meta[0],
url "https://www.sqlite.org/lang_corefunc.html#instr",
total_time 20000,
search_term Some("sqlite like"),
@ -1407,7 +1407,7 @@ mod tests {
// by url, referrer domain is different
let meta = query(&conn, "youtube", 10).expect("query should work");
assert_history_metadata_record!(&meta[0],
assert_history_metadata_record!(meta[0],
url "https://www.youtube.com/watch?v=tpiyEe_CqB4",
total_time 100000,
search_term Some("cute cat"),

Просмотреть файл

@ -21,7 +21,7 @@ pub use crate::repeat::*;
/// https://www.sqlite.org/faq.html, the only character that must be escaped is
/// the single quote, which is escaped by placing two single quotes in a row.
pub fn escape_string_for_pragma(s: &str) -> String {
s.replace("'", "''")
s.replace('\'', "''")
}
#[cfg(test)]

Просмотреть файл

@ -43,15 +43,15 @@ pub enum SyncEngineId {
impl SyncEngineId {
// Iterate over all possible engines
pub fn iter() -> impl Iterator<Item = SyncEngineId> {
// Once we switch to the 2021 edition, this can just be [ ... ].into_iter()
std::array::IntoIter::new([
[
Self::Passwords,
Self::History,
Self::Bookmarks,
Self::Tabs,
Self::Addresses,
Self::CreditCards,
])
]
.into_iter()
}
// Get the string identifier for this engine. This must match the strings in SyncEngineSelection.

Просмотреть файл

@ -20,8 +20,10 @@ but everything in the future is documented as "estimated".
Ultimately though, that page defines 2 Rust versions - "Uses" and "Requires",
and our policy revolves around these.
There is a [Meta bug on Bugzilla](https://bugzilla.mozilla.org/show_bug.cgi?id=1504858) that keeps
track of the latest versions mozilla-central uses as they are upgraded.
To discover the current, actual "Uses" version, there is a [Meta bug on Bugzilla](https://bugzilla.mozilla.org/show_bug.cgi?id=1504858) that keeps
track of the latest versions as they are upgraded.
To discover the current, actual "Requires" version, [see searchfox](https://searchfox.org/mozilla-central/search?q=MINIMUM_RUST_VERSION&path=python/mozboot/mozboot/util.py)
# application-services Rust version policy

Просмотреть файл

@ -7,7 +7,7 @@
# supported and used in CI.
[toolchain]
channel = "1.57.0"
channel = "1.60.0"
targets = [
"aarch64-linux-android",
"armv7-linux-androideabi",