Commit a0ebf989 authored by Hero Bird's avatar Hero Bird Committed by GitHub

Make CI happy again (#149)

* Adjust rustfmt.toml to newest rustfmt 1.3.3

* fix some minor warnings

* apply rustfmt

* fix formatting (make CI happy)
parent 242fe971
......@@ -5,7 +5,7 @@ newline_style = "Auto"
use_small_heuristics = "Default"
indent_style = "Block"
wrap_comments = false
format_doc_comments = false
format_code_in_doc_comments = false
comment_width = 80
normalize_comments = true # changed
normalize_doc_attributes = false
......@@ -35,7 +35,7 @@ struct_field_align_threshold = 0
enum_discrim_align_threshold = 0
match_arm_blocks = true
force_multiline_blocks = true # changed
fn_args_density = "Tall"
fn_args_layout = "Tall"
brace_style = "SameLineWhere"
control_brace_style = "AlwaysSameLine"
trailing_semicolon = false # changed
......@@ -51,7 +51,6 @@ use_field_init_shorthand = true # changed
force_explicit_abi = true
condense_wildcard_suffixes = false
color = "Auto"
required_version = "1.2.2"
unstable_features = true # changed
disable_all_formatting = false
skip_children = false
......
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
// This file is part of ink!.
//
// ink! is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ink! is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with ink!. If not, see <http://www.gnu.org/licenses/>.
use std::{
error::Error,
io::{
......@@ -46,7 +62,7 @@ fn zip_dir(
src_dir: &PathBuf,
dst_file: &PathBuf,
method: CompressionMethod,
) -> Result<(), Box<Error>> {
) -> Result<(), Box<dyn Error>> {
if !src_dir.is_dir() {
return Err(ZipError::FileNotFound.into())
}
......
......@@ -311,9 +311,9 @@ where
if self.cache.is_dirty() {
match self.cache.get_mut() {
Some(val) => {
self.cell.store(val);
val.flush();
},
self.cell.store(val);
val.flush();
}
None => self.cell.clear(),
}
self.cache.mark_clean();
......
......@@ -53,9 +53,9 @@ where
for (n, dirty_val) in self.cache.iter_dirty() {
match dirty_val.get_mut() {
Some(val) => {
self.chunk.store(n, val);
val.flush();
}
self.chunk.store(n, val);
val.flush();
}
None => self.chunk.clear(n),
}
dirty_val.mark_clean();
......
......@@ -15,11 +15,11 @@
// along with ink!. If not, see <http://www.gnu.org/licenses/>.
use super::BitPack;
use crate::storage::Flush;
use parity_codec::{
Decode,
Encode,
};
use crate::storage::Flush;
/// A block of 1024 bits.
#[derive(Debug, Copy, Clone, Encode, Decode)]
......@@ -29,7 +29,7 @@ pub struct BitBlock {
}
impl Flush for BitBlock {
fn flush(&mut self) {}
fn flush(&mut self) {}
}
/// Error indicating an invalid bit pack index.
......
......@@ -82,12 +82,12 @@ where
K: parity_codec::Encode + Flush,
V: parity_codec::Encode + Flush,
{
fn flush(&mut self) {
match self {
Entry::Occupied(occupied) => occupied.flush(),
Entry::Removed => (),
}
}
fn flush(&mut self) {
match self {
Entry::Occupied(occupied) => occupied.flush(),
Entry::Removed => (),
}
}
}
/// An occupied entry of a storage map.
......@@ -104,10 +104,10 @@ where
K: parity_codec::Encode + Flush,
V: parity_codec::Encode + Flush,
{
fn flush(&mut self) {
self.key.flush();
self.val.flush();
}
fn flush(&mut self) {
self.key.flush();
self.val.flush();
}
}
impl<K, V> Flush for HashMap<K, V>
......
......@@ -86,7 +86,7 @@ impl Flush for StashHeader {
fn flush(&mut self) {
self.next_vacant.flush();
self.len.flush();
self.max_len.flush();
self.max_len.flush();
}
}
......@@ -232,14 +232,14 @@ enum Entry<T> {
impl<T> Flush for Entry<T>
where
T: Flush,
T: Flush,
{
fn flush(&mut self) {
match self {
Entry::Vacant(_) => (),
Entry::Occupied(occupied) => occupied.flush(),
}
}
fn flush(&mut self) {
match self {
Entry::Vacant(_) => (),
Entry::Occupied(occupied) => occupied.flush(),
}
}
}
impl<T> Encode for Stash<T> {
......
......@@ -273,7 +273,7 @@ impl Parse for ast::MethodVisibility {
impl Parse for ast::ExternalVisibility {
fn parse(input: ParseStream<'_>) -> Result<Self> {
let pub_tok = input.parse::<Token![pub]>()?;
let mut content;
let content;
let paren_tok = syn::parenthesized!(content in input);
let external_tok = content.parse()?;
Ok(ast::ExternalVisibility {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment