Skip to content

Commit

Permalink
Upgrade rust to 1.57 (#4723)
Browse files Browse the repository at this point in the history
* upgrades rust to 1.57

* fixes clippy

* Document where to find the latest version moz-central uses

* an attempt to fix broken cargo bench

* Uses _ instead of dead_code where possible

* runs cargo update
  • Loading branch information
Tarik Eshaq authored Dec 20, 2021
1 parent f000e81 commit 36ae51e
Show file tree
Hide file tree
Showing 19 changed files with 149 additions and 149 deletions.
9 changes: 0 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,6 @@ jobs:
- store_artifacts:
path: raw_xcodebuild.log
destination: logs/raw_xcodebuild.log
- run:
name: Install Rust Nightly
command: |
# For now we need the nightly toolchain to build for the M1 simulator.
rustup install nightly
# For now we need to build the Rust stdlib from source for the M1 simulator.
rustup component add rust-src --toolchain nightly-x86_64-apple-darwin
rustup toolchain add nightly --profile minimal
rustup target add aarch64-apple-ios-sim --toolchain nightly
- run:
name: Build XCFramework archive
command: |
Expand Down
85 changes: 45 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/autofill/src/db/addresses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub(crate) fn get_address(conn: &Connection, guid: &Guid) -> Result<InternalAddr
WHERE guid = :guid",
common_cols = ADDRESS_COMMON_COLS
);
conn.query_row(&sql, &[guid], |row| InternalAddress::from_row(row))
conn.query_row(&sql, &[guid], InternalAddress::from_row)
.map_err(|e| match e {
rusqlite::Error::QueryReturnedNoRows => Error::NoSuchRecord(guid.to_string()),
e => e.into(),
Expand Down
3 changes: 3 additions & 0 deletions components/fxa-client/src/internal/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ pub enum PushPayload {
Unknown,
}

// Some of this structs fields are not read, except
// when deserialized, we mark them as dead_code
#[allow(dead_code)]
#[derive(Debug, Deserialize)]
pub struct CommandReceivedPushPayload {
command: String,
Expand Down
2 changes: 1 addition & 1 deletion components/logins/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::ffi::OsString;
// into `error_support`.
macro_rules! throw {
($e:expr) => {
return Err(Into::into($e));
return Err(Into::into($e))
};
}

Expand Down
22 changes: 11 additions & 11 deletions components/nimbus/src/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,24 @@ impl SingleStore {

pub fn put<T: serde::Serialize + for<'de> serde::Deserialize<'de>>(
&self,
mut writer: &mut Writer,
writer: &mut Writer,
key: &str,
persisted_data: &T,
) -> Result<()> {
let persisted_json = serde_json::to_string(persisted_data)?;
self.store
.put(&mut writer, key, &rkv::Value::Json(&persisted_json))?;
.put(writer, key, &rkv::Value::Json(&persisted_json))?;
Ok(())
}

#[allow(dead_code)]
pub fn delete(&self, mut writer: &mut Writer, key: &str) -> Result<()> {
self.store.delete(&mut writer, key)?;
pub fn delete(&self, writer: &mut Writer, key: &str) -> Result<()> {
self.store.delete(writer, key)?;
Ok(())
}

pub fn clear(&self, mut writer: &mut Writer) -> Result<()> {
self.store.clear(&mut writer)?;
pub fn clear(&self, writer: &mut Writer) -> Result<()> {
self.store.clear(writer)?;
Ok(())
}

Expand Down Expand Up @@ -336,7 +336,7 @@ impl Database {
/// to assume that this is unrecoverable and wipe the database, removing
/// people from any existing enrollments and blowing away their experiment
/// history, so that they don't get left in an inconsistent state.
fn migrate_v1_to_v2(&self, mut writer: &mut Writer) -> Result<()> {
fn migrate_v1_to_v2(&self, writer: &mut Writer) -> Result<()> {
log::info!("Upgrading from version 1 to version 2");

// use try_collect_all to read everything except records that serde
Expand Down Expand Up @@ -392,16 +392,16 @@ impl Database {
log::debug!("updated enrollments = {:?}", updated_enrollments);

// rewrite both stores
self.experiment_store.clear(&mut writer)?;
self.experiment_store.clear(writer)?;
for experiment in updated_experiments {
self.experiment_store
.put(&mut writer, &experiment.slug, &experiment)?;
.put(writer, &experiment.slug, &experiment)?;
}

self.enrollment_store.clear(&mut writer)?;
self.enrollment_store.clear(writer)?;
for enrollment in updated_enrollments {
self.enrollment_store
.put(&mut writer, &enrollment.slug, &enrollment)?;
.put(writer, &enrollment.slug, &enrollment)?;
}
log::debug!("exiting migrate_v1_to_v2");

Expand Down
Loading

0 comments on commit 36ae51e

Please sign in to comment.