random fixes (#638)

This commit is contained in:
Guanqun Lu
2018-08-31 20:33:05 +08:00
committed by Gav Wood
parent cd68c9b001
commit 27b5e70baa
2 changed files with 9 additions and 6 deletions
+5 -2
View File
@@ -33,7 +33,7 @@
//! fn main() {
//! // declare a stack variable of the same type as our global declaration.
//! let mut counter_value = 41u32;
//! // call stuff, setting up our `counter` environment as a refrence to our counter_value var.
//! // call stuff, setting up our `counter` environment as a reference to our counter_value var.
//! counter::using(&mut counter_value, stuff);
//! println!("The answer is {:?}", counter_value); // will print 42!
//! stuff(); // safe! doesn't do anything.
@@ -234,10 +234,11 @@ mod tests {
// declare a stack variable of the same type as our global declaration.
let mut local = 41u32;
// call stuff, setting up our `counter` environment as a refrence to our local counter var.
// call stuff, setting up our `counter` environment as a reference to our local counter var.
counter::using(&mut local, stuff);
assert_eq!(local, 42);
stuff(); // safe! doesn't do anything.
assert_eq!(local, 42);
}
#[test]
@@ -280,6 +281,8 @@ mod tests {
assert_eq!(local, 42);
stuff(); // doesn't do anything.
assert_eq!(local, 42);
}
#[test]
+4 -4
View File
@@ -15,7 +15,7 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
//! State database maintenance. Handles finalization and pruning in the database. The input to
//! this module is a `ChangeSet` which is basicall a list of key-value pairs (trie nodes) that
//! this module is a `ChangeSet` which is basically a list of key-value pairs (trie nodes) that
//! were added or deleted during block execution.
//!
//! # Finalization.
@@ -94,7 +94,7 @@ impl<E: fmt::Debug> fmt::Debug for Error<E> {
pub struct ChangeSet<H: Hash> {
/// Inserted nodes.
pub inserted: Vec<(H, DBValue)>,
/// Delted nodes.
/// Deleted nodes.
pub deleted: Vec<H>,
}
@@ -108,7 +108,7 @@ pub struct CommitSet<H: Hash> {
pub meta: ChangeSet<Vec<u8>>,
}
/// Pruning contraints. If none are specified pruning is
/// Pruning constraints. If none are specified pruning is
#[derive(Default, Debug, Clone)]
pub struct Constraints {
/// Maximum blocks. Defaults to 0 when unspecified, effectively keeping only unfinalized states.
@@ -187,7 +187,7 @@ impl<BlockHash: Hash, Key: Hash> StateDbSync<BlockHash, Key> {
match self.mode {
PruningMode::ArchiveAll => {
changeset.deleted.clear();
// write changes immediatelly
// write changes immediately
CommitSet {
data: changeset,
meta: Default::default(),