apply cargo fmt

This commit is contained in:
vms 2019-09-09 16:03:16 +03:00
parent 01c54bef40
commit dcb8ef341c
2 changed files with 27 additions and 8 deletions

View File

@ -85,7 +85,7 @@ fn statement_to_string(statement: ExecuteStatementResponse) -> String {
.join("\n");
col_names + &rows_as_str
}
},
ExecuteStatementResponse::Deleted(number) => format!("rows deleted: {}", number),
ExecuteStatementResponse::Explain(result) => result,
ExecuteStatementResponse::Updated(number) => format!("rows updated: {}", number),

View File

@ -1,3 +1,19 @@
/*
* Copyright 2019 Fluence Labs Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use crate::GenResult;
use core::fmt;
use std::num::ParseIntError;
@ -26,7 +42,7 @@ struct Signed<'a> {
impl<'a> Signed<'a> {
pub fn payload(&self) -> GenResult<&'a str> {
let pos = self.nonce_payload.find("\n").ok_or(err_msg(&format!(
let pos = self.nonce_payload.find('\n').ok_or(err_msg(&format!(
"Invalid input: no \\n between nonce and payload in `{}`. \
Should be <signature hex>\\n<nonce>\\n<sql_query>",
self.nonce_payload
@ -42,11 +58,11 @@ lazy_static! {
/// hard-coded public key, could be replaced directly in a final Wasm binary
// Full: 64 + 1 byte prefix
static PUBLIC_KEY: [u8; 65] = [
0x04,
0xba,0x94,0x28,0x52,0xe4,0x35,0x39,0x1b,0x2a,0x6a,0x99,0x3f,0x33,0xf7,0x0c,0x43,
0x92,0x35,0xf4,0x84,0x15,0xe2,0x5c,0x66,0x8d,0x97,0xd5,0xb0,0xf2,0x63,0xb5,0x4e,
0x9d,0x98,0xcc,0xae,0xfd,0xc5,0xc6,0xca,0x23,0x7f,0xfc,0x0f,0x2f,0x63,0x35,0x13,
0x30,0xfa,0xaf,0xe3,0x1d,0x12,0x03,0x79,0xb8,0xdf,0xf9,0x82,0xa3,0x73,0x58,0xe3
0x04, 0xba, 0x94, 0x28, 0x52, 0xe4, 0x35, 0x39, 0x1b, 0x2a, 0x6a, 0x99, 0x3f, 0x33, 0xf7, 0x0c,
0x43, 0x92, 0x35, 0xf4, 0x84, 0x15, 0xe2, 0x5c, 0x66, 0x8d, 0x97, 0xd5, 0xb0, 0xf2, 0x63, 0xb5,
0x4e, 0x9d, 0x98, 0xcc, 0xae, 0xfd, 0xc5, 0xc6, 0xca, 0x23, 0x7f, 0xfc, 0x0f, 0x2f, 0x63, 0x35,
0x13, 0x30, 0xfa, 0xaf, 0xe3, 0x1d, 0x12, 0x03, 0x79, 0xb8, 0xdf, 0xf9, 0x82, 0xa3, 0x73, 0x58,
0xe3,
];
fn get_pk() -> PublicKey {
@ -60,7 +76,10 @@ fn err_msg(s: &str) -> Box<Error> {
/// Converts hex string to a Vec<u8>
fn decode_hex(s: &str) -> GenResult<Vec<u8>> {
if s.len() % 2 != 0 {
return Err(err_msg(&format!("Invalid hex length: {} isn't divisible by 2", s.len())))
return Err(err_msg(&format!(
"Invalid hex length: {} isn't divisible by 2",
s.len()
)));
}
(0..s.len())
.step_by(2)