Bug 1548195 - fix xulstore warnings/errors on Rust 1.36 r=froydnj
authorMyk Melez <myk@mykzilla.org>
Fri, 10 May 2019 13:40:03 +0000
changeset 532231 6166be9aa8666ffcf128bec8f30ecaa165b1ce9a
parent 532230 44db460adb2b732a8444e0f35c968bd828313e12
child 532232 905f054bd2c9acc944a626d08e1f4071d45aa2ec
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1548195
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1548195 - fix xulstore warnings/errors on Rust 1.36 r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D30570
toolkit/components/xulstore/src/lib.rs
toolkit/components/xulstore/src/persist.rs
--- a/toolkit/components/xulstore/src/lib.rs
+++ b/toolkit/components/xulstore/src/lib.rs
@@ -187,17 +187,17 @@ pub(crate) fn get_ids(doc: &nsAString) -
     let cache_guard = DATA_CACHE.lock()?;
     let data = match cache_guard.as_ref() {
         Some(data) => data,
         None => return Ok(XULStoreIterator::new(vec![].into_iter())),
     };
 
     match data.get(&doc.to_string()) {
         Some(ids) => {
-            let mut ids: Vec<String> = ids.keys().cloned().collect();
+            let ids: Vec<String> = ids.keys().cloned().collect();
             Ok(XULStoreIterator::new(ids.into_iter()))
         }
         None => Ok(XULStoreIterator::new(vec![].into_iter())),
     }
 }
 
 pub(crate) fn get_attrs(doc: &nsAString, id: &nsAString) -> XULStoreResult<XULStoreIterator> {
     debug!("XULStore get attrs for doc, ID: {} {}", doc, id);
@@ -206,16 +206,16 @@ pub(crate) fn get_attrs(doc: &nsAString,
     let data = match cache_guard.as_ref() {
         Some(data) => data,
         None => return Ok(XULStoreIterator::new(vec![].into_iter())),
     };
 
     match data.get(&doc.to_string()) {
         Some(ids) => match ids.get(&id.to_string()) {
             Some(attrs) => {
-                let mut attrs: Vec<String> = attrs.keys().cloned().collect();
+                let attrs: Vec<String> = attrs.keys().cloned().collect();
                 Ok(XULStoreIterator::new(attrs.into_iter()))
             }
             None => Ok(XULStoreIterator::new(vec![].into_iter())),
         },
         None => Ok(XULStoreIterator::new(vec![].into_iter())),
     }
 }
--- a/toolkit/components/xulstore/src/persist.rs
+++ b/toolkit/components/xulstore/src/persist.rs
@@ -1,37 +1,37 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
+//! The XULStore API is synchronous for both C++ and JS consumers and accessed
+//! on the main thread, so we persist its data to disk on a background thread
+//! to avoid janking the UI.
+//!
+//! We also re-open the database each time we write to it in order to conserve
+//! heap memory, since holding a database connection open would consume at least
+//! 3MB of heap memory in perpetuity.
+//!
+//! Since re-opening the database repeatedly to write individual changes can be
+//! expensive when there are many of them in quick succession, we batch changes
+//! and write them in batches.
+
 use crate::{
     error::{XULStoreError, XULStoreResult},
     ffi::XpcomShutdownObserver,
     statics::get_database,
 };
 use crossbeam_utils::atomic::AtomicCell;
 use lmdb::Error as LmdbError;
 use moz_task::{create_thread, Task, TaskRunnable};
 use nserror::nsresult;
 use rkv::{StoreError as RkvStoreError, Value};
 use std::{collections::HashMap, sync::Mutex, thread::sleep, time::Duration};
 use xpcom::{interfaces::nsIThread, RefPtr, ThreadBoundRefPtr};
 
-/// The XULStore API is synchronous for both C++ and JS consumers and accessed
-/// on the main thread, so we persist its data to disk on a background thread
-/// to avoid janking the UI.
-///
-/// We also re-open the database each time we write to it in order to conserve
-/// heap memory, since holding a database connection open would consume at least
-/// 3MB of heap memory in perpetuity.
-///
-/// Since re-opening the database repeatedly to write individual changes can be
-/// expensive when there are many of them in quick succession, we batch changes
-/// and write them in batches.
-
 lazy_static! {
     /// A map of key/value pairs to persist.  Values are Options so we can
     /// use the same structure for both puts and deletes, with a `None` value
     /// identifying a key that should be deleted from the database.
     ///
     /// This is a map rather than a sequence in order to merge consecutive
     /// changes to the same key, i.e. when a consumer sets *foo* to `bar`
     /// and then sets it again to `baz` before we persist the first change.