-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
899403d
to
b70b96c
Compare
ethcore/src/json_tests/macros.rs
Outdated
// TODO(niklasad1): use expect or unwrap only used for tests?! | ||
#[doc(hidden)] | ||
pub fn write_and_flush(s: String) { | ||
let _ = std::io::Write::write_all(&mut std::io::stdout(), s.as_bytes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this to write_all
instead of write
seems better because we are not notified if only a part of the buffer is written, thoughts?
@@ -2,12 +2,14 @@ | |||
name = "migration-rocksdb" | |||
version = "0.1.0" | |||
authors = ["Parity Technologies <admin@parity.io>"] | |||
edition = "2018" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I couldn't resist, it was such a simple fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, good riddance.
(what's up with the force-push, makes it hard to review additions) |
@@ -37,8 +37,7 @@ pub fn json_difficulty_test<H: FnMut(&str, HookType)>( | |||
for (name, test) in tests.into_iter() { | |||
start_stop_hook(&name, HookType::OnStart); | |||
|
|||
flush!(" - {}...", name); | |||
println!(" - {}...", name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant, let's replace with writeln
+ flush
.
Sorry, my bad it just think is so ugly will |
} else { | ||
"".into() | ||
}; | ||
let empty_steps = header_empty_steps(header).as_ref().map_or(String::new(), |empty_steps| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is also unrelated, I found this piece very hard to read especially the fold
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
`write` is performed to `stdout` `logging` is performed to `stderr`
rpc/src/v1/types/sync.rs
Outdated
H512::from_low_u64_be(10) => 50 | ||
], | ||
propagated_to: { | ||
let mut map = BTreeMap::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not a btreemap!
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, I think I started to investigate if we could get rid of map
completely but forgot this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you left it on purpose. Why use a macro when it doesn’t save much typing and doesn’t make the code clearer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just too lazy, my rule of thumb is when we have more than 2-3 items in a BTreeMap then I use btreemap!
.
At least after this change we are consistent in the crate but I saw that we can easily remove maplit
in the rpc crate
EDIT: when it comes to dev-dependencies
I'm more willing to use those macros than in production code
* master: (27 commits) Faster kill_garbage (#11514) [EngineSigner]: don't sign message with only zeroes (#11524) fix compilation warnings (#11522) [ethcore cleanup]: various unrelated fixes from `#11493` (#11507) Add benchmark for transaction execution (#11509) Add Smart Contract License v1.0 Misc fixes (#11510) [dependencies]: unify `rustc-hex` (#11506) Activate on-chain randomness in POA Sokol (#11505) Grab bag of cleanup (#11504) Implement eth/64 (EIP-2364) and drop support for eth/62 (#11472) [dependencies]: remove `util/macros` (#11501) OpenEthereum bootnodes are added (#11499) [ci benches]: use `all-features` (#11496) [verification]: make test-build compile standalone (#11495) complete null-signatures removal (#11491) Include the seal when populating the header for a new block (#11475) fix compilation warnings (#11492) cargo update -p cmake (#11490) update to published rlp-derive (#11489) ...
Closing #11478
Nothing very exciting in this PR to summarize:
util/macros
crate, moveflush!
andflushln!
toethcore/json_tests
.macros
withmaplit
slice_into
andvec_into
are removedNote, I didn't replace
flush, flushln
with logging in the json-tests. Let's keep out of this PR