fix(compilation warnings) (#10649)

This commit is contained in:
Niklas Adolfsson 2019-05-13 15:10:25 +02:00 committed by GitHub
parent 42268fd1ef
commit 87699f8de0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 12 deletions

View File

@ -273,7 +273,7 @@ impl Importer {
let (imported_blocks, import_results, invalid_blocks, imported, proposed_blocks, duration, has_more_blocks_to_import) = {
let mut imported_blocks = Vec::with_capacity(max_blocks_to_import);
let mut invalid_blocks = HashSet::new();
let mut proposed_blocks = Vec::with_capacity(max_blocks_to_import);
let proposed_blocks = Vec::with_capacity(max_blocks_to_import);
let mut import_results = Vec::with_capacity(max_blocks_to_import);
let _import_lock = self.import_lock.lock();

View File

@ -287,8 +287,7 @@ impl Clique {
"Back-filling block state. last_checkpoint_number: {}, target: {}({}).",
last_checkpoint_number, header.number(), header.hash());
let mut chain: &mut VecDeque<Header> = &mut VecDeque::with_capacity(
(header.number() - last_checkpoint_number + 1) as usize);
let mut chain = VecDeque::with_capacity((header.number() - last_checkpoint_number + 1) as usize);
// Put ourselves in.
chain.push_front(header.clone());
@ -332,7 +331,7 @@ impl Clique {
// Backfill!
let mut new_state = last_checkpoint_state.clone();
for item in chain {
for item in &chain {
new_state.apply(item, false)?;
}
new_state.calc_next_timestamp(header.timestamp(), self.period)?;

View File

@ -277,7 +277,7 @@ impl Engine<EthereumMachine> for Arc<Ethash> {
let n_uncles = block.uncles.len();
// Bestow block rewards.
let mut result_block_reward = reward + reward.shr(5) * U256::from(n_uncles);
let result_block_reward = reward + reward.shr(5) * U256::from(n_uncles);
rewards.push((author, RewardKind::Author, result_block_reward));

View File

@ -259,7 +259,7 @@ impl<T: InformantData> Informant<T> {
let elapsed = now.duration_since(*self.last_tick.read());
let (client_report, full_report) = {
let mut last_report = self.last_report.lock();
let last_report = self.last_report.lock();
let full_report = self.target.report();
let diffed = full_report.client_report.clone() - &*last_report;
(diffed, full_report)

View File

@ -113,20 +113,20 @@ pub fn request(address: &SocketAddr, request: &str) -> Response {
pub fn assert_security_headers_present(headers: &[String], port: Option<u16>) {
if port.is_none() {
assert!(
headers.iter().any(|header| header.as_str() == "X-Frame-Options: SAMEORIGIN")
headers.iter().any(|header| header.as_str() == "X-Frame-Options: SAMEORIGIN"),
"X-Frame-Options: SAMEORIGIN missing: {:?}", headers
);
}
assert!(
headers.iter().any(|header| header.as_str() == "X-XSS-Protection: 1; mode=block")
headers.iter().any(|header| header.as_str() == "X-XSS-Protection: 1; mode=block"),
"X-XSS-Protection missing: {:?}", headers
);
assert!(
headers.iter().any(|header| header.as_str() == "X-Content-Type-Options: nosniff")
headers.iter().any(|header| header.as_str() == "X-Content-Type-Options: nosniff"),
"X-Content-Type-Options missing: {:?}", headers
);
assert!(
headers.iter().any(|header| header.starts_with("Content-Security-Policy: "))
headers.iter().any(|header| header.starts_with("Content-Security-Policy: ")),
"Content-Security-Policy missing: {:?}", headers
)
}

View File

@ -129,7 +129,7 @@ impl<P: PostSign> Future for ProspectiveSigner<P> {
.into_future());
},
WaitForPostSign => {
if let Some(mut fut) = self.post_sign_future.as_mut() {
if let Some(fut) = self.post_sign_future.as_mut() {
match fut.poll()? {
Async::Ready(item) => {
let nonce = self.ready

View File

@ -616,7 +616,7 @@ impl Host {
let socket = {
let address = {
let mut nodes = self.nodes.read();
let nodes = self.nodes.read();
if let Some(node) = nodes.get(id) {
node.endpoint.address
} else {