Rustify core/src/core (#1122)

Small refactoring of one folder, if it makes sense I could extend the scope.
* Remove some cloning (real and just verbosity in the code)
* Naming conventions like to/into*
* Some Clippy's suggestions

I found that we don't use field init shorthand syntax, so I didn't touch this part, was it discussed before?
This commit is contained in:
hashmap
2018-06-01 21:41:26 +02:00
committed by Yeastplume
parent 7812a02233
commit 2fa32d15ce
27 changed files with 215 additions and 263 deletions
+1 -1
View File
@@ -376,7 +376,7 @@ impl Server {
last_time = time;
DiffBlock {
block_number: height,
difficulty: diff.into_num(),
difficulty: diff.to_num(),
time: time,
duration: dur,
}
+5 -5
View File
@@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::{thread, cmp};
use std::time::Duration;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::time::Duration;
use std::{cmp, thread};
use time;
use chain;
@@ -296,7 +296,7 @@ fn needs_syncing(
info!(
LOGGER,
"synchronised at {} @ {} [{}]",
local_diff.into_num(),
local_diff.to_num(),
ch.height,
ch.last_block_h
);
@@ -338,8 +338,8 @@ fn needs_syncing(
}
/// We build a locator based on sync_head.
/// Even if sync_head is significantly out of date we will "reset" it once we start getting
/// headers back from a peer.
/// Even if sync_head is significantly out of date we will "reset" it once we
/// start getting headers back from a peer.
///
/// TODO - this gets *expensive* with a large header chain to iterate over
/// as we need to get each block header from the db