Skip to content

Commit

Permalink
Rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
asonix committed Jan 7, 2018
1 parent af094b2 commit 8b3aa54
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
12 changes: 7 additions & 5 deletions examples/load_balancing_broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@ fn worker_task(worker_num: usize) -> usize {
.and_then(|multipart| {
let mut envelope: Envelope = multipart.try_into()?;

println!("Worker: {:?} from {:?}", envelope.request().as_str(), envelope.addr().as_str());
println!(
"Worker: {:?} from {:?}",
envelope.request().as_str(),
envelope.addr().as_str()
);

let msg = zmq::Message::from_slice(b"OK")?;
envelope.set_request(msg);
Expand Down Expand Up @@ -327,17 +331,15 @@ fn main() {
let mut broker_thread = None;

match use_broker {
UseBroker::Yes |
UseBroker::All => {
UseBroker::Yes | UseBroker::All => {
// Spawn threads
broker_thread = Some(thread::spawn(broker_task));
}
_ => (),
}

match use_broker {
UseBroker::No |
UseBroker::All => {
UseBroker::No | UseBroker::All => {
// Set up control socket
let mut core = Core::new().unwrap();
let context = Rc::new(zmq::Context::new());
Expand Down
46 changes: 23 additions & 23 deletions tokio-zmq-derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
extern crate proc_macro;
extern crate syn;

#[macro_use]
extern crate synstructure;
#[macro_use]
extern crate quote;
#[macro_use]
extern crate synstructure;

decl_derive!([SocketWrapper, attributes(stream, sink, controlled, try_from)] => socket_derive);
decl_derive!([ControlledSocketWrapper, attributes(sink)] => controlled_socket_derive);
Expand All @@ -26,14 +26,14 @@ fn socket_derive(s: synstructure::Structure) -> quote::Tokens {
let as_socket = s.bound_impl(
"::prelude::AsSocket",
quote! {
fn socket(&self) -> &Socket {
&self.inner
}
fn socket(&self) -> &Socket {
&self.inner
}

fn into_socket(self) -> Socket {
self.inner
}
},
fn into_socket(self) -> Socket {
self.inner
}
},
);

let name = sb.ast().ident;
Expand Down Expand Up @@ -122,17 +122,17 @@ fn into_controlled(s: &synstructure::Structure) -> quote::Tokens {
s.bound_impl(
"::prelude::IntoControlledSocket",
quote! {
type Controlled = #control;

fn controlled<S>(self, control: S) -> Self::Controlled
where
S: ::prelude::StreamSocket,
{
#control {
inner: self.inner.controlled(control)
type Controlled = #control;

fn controlled<S>(self, control: S) -> Self::Controlled
where
S: ::prelude::StreamSocket,
{
#control {
inner: self.inner.controlled(control)
}
}
}
},
},
)
} else {
quote!{}
Expand All @@ -156,10 +156,10 @@ fn controlled_socket_derive(s: synstructure::Structure) -> quote::Tokens {
let as_socket = s.bound_impl(
"::prelude::AsControlledSocket",
quote! {
fn socket(&self) -> &ControlledSocket {
&self.inner
}
},
fn socket(&self) -> &ControlledSocket {
&self.inner
}
},
);

let stream = s.bound_impl("::prelude::ControlledStreamSocket", quote!{});
Expand Down

0 comments on commit 8b3aa54

Please sign in to comment.