Repository: websockets-rs/rust-websocket (language: rust)

Issue:
Does the server.rs example need to use a move closure?
See [here](https://github.com/cyderize/rust-websocket/blob/7bd2defaf98c3dec8a9b5e7dc93cbbc887e97d5a/examples/server.rs#L12).

It's not capturing anything from the parent scope so doesn't need to move, right? Seems to still compile and work without it for me.


Discussion / hints:
I can do a quick PR if I'm correct but I wanted to ask first since I'm not very experienced with Rust.

Fix patch:
diff --git a/examples/async-autobahn-client.rs b/examples/async-autobahn-client.rs
index 46817ddd4c..29c5bee061 100644
--- a/examples/async-autobahn-client.rs
+++ b/examples/async-autobahn-client.rs
@@ -30,7 +30,7 @@ fn main() {
 		let test_case = ClientBuilder::new(&url)
 			.unwrap()
 			.async_connect_insecure()
-			.and_then(move |(duplex, _)| {
+			.and_then(|(duplex, _)| {
 				println!("Executing test case: {}/{}", case_id, case_count);
 				future::loop_fn(duplex, |stream| {
 					stream
@@ -69,10 +69,10 @@ fn main() {
 						})
 				})
 			})
-			.map(move |_| {
+			.map(|_| {
 				println!("Test case {} is finished!", case_id);
 			})
-			.or_else(move |err| {
+			.or_else(|err| {
 				println!("Test case {} ended with an error: {:?}", case_id, err);
 				Ok(()) as Result<(), ()>
 			});
diff --git a/examples/async-client.rs b/examples/async-client.rs
index 9d9dd6d3bf..3b347951ec 100644
--- a/examples/async-client.rs
+++ b/examples/async-client.rs
@@ -22,7 +22,7 @@ fn main() {
 	// standard in isn't supported in mio yet, so we use a thread
 	// see https://github.com/carllerche/mio/issues/321
 	let (usr_msg, stdin_ch) = mpsc::channel(0);
-	thread::spawn(move || {
+	thread::spawn(|| {
 		let mut input = String::new();
 		let mut stdin_sink = usr_msg.wait();
 		loop {
diff --git a/examples/autobahn-server.rs b/examples/autobahn-server.rs
index b9431d7124..b15b6d3cbc 100644
--- a/examples/autobahn-server.rs
+++ b/examples/autobahn-server.rs
@@ -8,7 +8,7 @@ fn main() {
 	let server = Server::bind("127.0.0.1:9002").unwrap();
 
 	for connection in server.filter_map(Result::ok) {
-		thread::spawn(move || {
+		thread::spawn(|| {
 			let client = connection.accept().unwrap();
 
 			let (mut receiver, mut sender) = client.split().unwrap();
diff --git a/examples/hyper.rs b/examples/hyper.rs
index 2b93dd3aa9..bf7dbddefd 100644
--- a/examples/hyper.rs
+++ b/examples/hyper.rs
@@ -22,7 +22,7 @@ fn http_handler(_: Request, response: Response<Fresh>) {
 
 fn main() {
 	// Start listening for http connections
-	thread::spawn(move || {
+	thread::spawn(|| {
 		let http_server = HttpServer::http("127.0.0.1:8080").unwrap();
 		http_server.handle(http_handler).unwrap();
 	});
@@ -32,7 +32,7 @@ fn main() {
 
 	for connection in ws_server.filter_map(Result::ok) {
 		// Spawn a new thread for each connection.
-		thread::spawn(move || {
+		thread::spawn(|| {
 			if !connection
 				.protocols()
 				.contains(&"rust-websocket".to_string())
diff --git a/examples/parallel-server.rs b/examples/parallel-server.rs
index 7bb59ced57..da78084fbd 100644
--- a/examples/parallel-server.rs
+++ b/examples/parallel-server.rs
@@ -58,7 +58,7 @@ fn main() {
 		.map_err(|_| ());
 
 	// Handle receiving messages from a client
-	let receive_handler = receive_channel_in.for_each(move |(id, stream)| {
+	let receive_handler = receive_channel_in.for_each(|(id, stream)| {
 		stream
 			.for_each(move |msg| {
 				process_message(id, &msg);
diff --git a/examples/server.rs b/examples/server.rs
index 84750ea2cd..f1e3718bf7 100644
--- a/examples/server.rs
+++ b/examples/server.rs
@@ -9,7 +9,7 @@ fn main() {
 
 	for request in server.filter_map(Result::ok) {
 		// Spawn a new thread for each connection.
-		thread::spawn(move || {
+		thread::spawn(|| {
 			if !request.protocols().contains(&"rust-websocket".to_string()) {
 				request.reject().unwrap();
 				return;
diff --git a/examples/ssl-client.rs b/examples/ssl-client.rs
index e06f9c1f94..d616874ab9 100644
--- a/examples/ssl-client.rs
+++ b/examples/ssl-client.rs
@@ -22,7 +22,7 @@ fn main() {
 	// standard in isn't supported in mio yet, so we use a thread
 	// see https://github.com/carllerche/mio/issues/321
 	let (usr_msg, stdin_ch) = mpsc::channel(0);
-	thread::spawn(move || {
+	thread::spawn(|| {
 		let mut input = String::new();
 		let mut stdin_sink = usr_msg.wait();
 		loop {


Test patch: