Skip to content

Commit

Permalink
Chore/semi colons (#799)
Browse files Browse the repository at this point in the history
* Add helpers for easier Transports creation (#777)

* Add helpers for easier Transports creation

* Fix doctests

* Fix ' ;' occurrences
  • Loading branch information
jamesray1 authored and twittner committed Dec 19, 2018
1 parent 83320e0 commit f541df3
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion misc/core-derive/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn event_handler() {

impl<TSubstream: libp2p::tokio_io::AsyncRead + libp2p::tokio_io::AsyncWrite> Foo<TSubstream> {
// TODO: for some reason, the parameter cannot be the event type or we
// get a compilation error ; figure out why or open an issue to Rust
// get a compilation error; figure out why or open an issue to Rust
fn foo<TTopology>(&mut self, ev: <libp2p::ping::PingListen<TSubstream> as libp2p::core::swarm::NetworkBehaviour<TTopology>>::OutEvent) {
}
}
Expand Down
8 changes: 4 additions & 4 deletions misc/mdns/src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ pub fn decode_character_string(mut from: &[u8]) -> Result<Cow<[u8]>, ()> {
pub fn build_query() -> Vec<u8> {
let mut out = Vec::with_capacity(33);

// Program-generated transaction ID ; unused by our implementation.
// Program-generated transaction ID; unused by our implementation.
append_u16(&mut out, rand::random());

// Flags ; 0x0 for a regular query.
// 0x0 flag for a regular query.
append_u16(&mut out, 0x0);

// Number of questions.
Expand Down Expand Up @@ -98,7 +98,7 @@ pub fn build_query_response(
let mut out = Vec::with_capacity(320);

append_u16(&mut out, id);
// Flags ; 0x84 for an answer.
// 0x84 flag for an answer.
append_u16(&mut out, 0x8400);
// Number of questions, answers, authorities, additionals.
append_u16(&mut out, 0x0);
Expand Down Expand Up @@ -156,7 +156,7 @@ pub fn build_service_discovery_response(id: u16, ttl: Duration) -> Vec<u8> {
let mut out = Vec::with_capacity(69);

append_u16(&mut out, id);
// Flags ; 0x84 for an answer.
// 0x84 flag for an answer.
append_u16(&mut out, 0x8400);
// Number of questions, answers, authorities, additionals.
append_u16(&mut out, 0x0);
Expand Down
4 changes: 2 additions & 2 deletions misc/mdns/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl MdnsService {
/// Polls the service for packets.
pub fn poll(&mut self) -> Async<MdnsPacket> {
// Send a query every time `query_interval` fires.
// Note that we don't use a loop here ; it is pretty unlikely that we need it, and there is
// Note that we don't use a loop hereit is pretty unlikely that we need it, and there is
// no point in sending multiple requests in a row.
match self.query_interval.poll() {
Ok(Async::Ready(_)) => {
Expand Down Expand Up @@ -472,7 +472,7 @@ impl<'a> fmt::Debug for MdnsResponse<'a> {

/// A peer discovered by the service.
pub struct MdnsPeer<'a> {
/// The original packet ; will be used to determine the addresses.
/// The original packet which will be used to determine the addresses.
packet: &'a Packet<'a>,
/// Cached value of `concat(base32(peer_id), service name)`.
record_value: String,
Expand Down
6 changes: 3 additions & 3 deletions protocols/identify/src/id_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ where TMuxer: muxing::StreamMuxer + Send + Sync + 'static,
// Here is a tricky part: we need to get back the muxer in order to return
// it, but it is in an `Arc`.
let unwrapped = Arc::try_unwrap(muxer).unwrap_or_else(|_| {
panic!("we clone the Arc only to put it into substreams ; once in the \
Finishing state, no substream or upgrade exists anymore ; \
therefore there exists only one instance of the Arc; QED")
panic!("We clone the Arc only to put it into substreams. Once in the \
Finishing state, no substream or upgrade exists anymore. \
Therefore, there exists only one instance of the Arc. QED")
});

// We leave `Poisoned` as the state when returning.
Expand Down
2 changes: 1 addition & 1 deletion protocols/identify/src/identify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ where
}
EitherOutput::First(sender) => {
let observed = self.observed_addresses.get(&peer_id)
.expect("We only receive events from nodes we're connected to ; we insert \
.expect("We only receive events from nodes we're connected to. We insert \
into the hashmap when we connect to a node and remove only when we \
disconnect; QED");
self.to_answer.push((sender, observed.clone()));
Expand Down
2 changes: 1 addition & 1 deletion protocols/kad/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ where
let (query, purpose, provider_peers) = self
.active_queries
.remove(&finished_query)
.expect("finished_query was gathered when iterating active_queries ; qed");
.expect("finished_query was gathered when iterating active_queries; QED.");
match purpose {
QueryPurpose::Initialization => {},
QueryPurpose::UserRequest => {
Expand Down
4 changes: 2 additions & 2 deletions protocols/kad/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,8 @@ fn process_kad_request<TUserData>(
) -> Result<KademliaHandlerEvent<TUserData>, io::Error> {
match event {
KadRequestMsg::Ping => {
// TODO: implement ; in practice the PING message is never used, so we may consider
// removing it altogether
// TODO: implement; although in practice the PING message is never
// used, so we may consider removing it altogether
Err(io::Error::new(
io::ErrorKind::InvalidData,
"the PING Kademlia message is not implemented",
Expand Down
6 changes: 3 additions & 3 deletions protocols/kad/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ enum QueryStage {
Iterating {
/// Number of successful query results in a row that didn't find any closer node.
// TODO: this is not great, because we don't necessarily receive responses in the order
// we made the queries ; it is possible that we query multiple far-away nodes in a
// row, and obtain results before the result of the closest nodes
// we made the queries. It is possible that we query multiple far-away nodes in a
// row, and obtain results before the result of the closest nodes.
no_closer_in_a_row: usize,
},

Expand Down Expand Up @@ -268,7 +268,7 @@ impl QueryState {
_ => (),
};

// We have enough results ; the query is done.
// We have enough results; the query is done.
if succeeded_counter
.as_ref()
.map(|&c| c >= num_results)
Expand Down
2 changes: 1 addition & 1 deletion protocols/ping/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ where TSocket: AsyncRead + AsyncWrite
PingListenerState::Listening => {
match self.inner.poll() {
Ok(Async::Ready(Some(payload))) => {
debug!("Received ping (payload={:?}) ; sending back", payload);
debug!("Received ping (payload={:?}); sending back", payload);
self.state = PingListenerState::Sending(payload.freeze())
},
Ok(Async::Ready(None)) => self.state = PingListenerState::Closing,
Expand Down

0 comments on commit f541df3

Please sign in to comment.