Skip to content

Commit 019c808

Browse files
author
Stjepan Glavina
committed
Cleanup examples
1 parent ab51991 commit 019c808

37 files changed

+146
-67
lines changed

examples/list-dir.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
use std::env::args;
66

7-
use async_std::{fs, io, prelude::*, task};
7+
use async_std::fs;
8+
use async_std::io;
9+
use async_std::prelude::*;
10+
use async_std::task;
811

912
fn main() -> io::Result<()> {
1013
let path = args().nth(1).expect("missing path argument");

examples/print-file.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
use std::env::args;
66

7-
use async_std::{fs::File, io, prelude::*, task};
7+
use async_std::fs::File;
8+
use async_std::io;
9+
use async_std::prelude::*;
10+
use async_std::task;
811

912
const LEN: usize = 4 * 1024 * 1024; // 4 Mb
1013

examples/stdin-echo.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
33
#![feature(async_await)]
44

5-
use async_std::{io, prelude::*, task};
5+
use async_std::io;
6+
use async_std::prelude::*;
7+
use async_std::task;
68

79
fn main() -> io::Result<()> {
810
task::block_on(async {

examples/stdin-timeout.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
use std::time::Duration;
66

7-
use async_std::{io, prelude::*, task};
7+
use async_std::io;
8+
use async_std::prelude::*;
9+
use async_std::task;
810

911
fn main() -> io::Result<()> {
1012
task::block_on(async {

examples/task-local.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
use std::cell::Cell;
66

7-
use async_std::{task, task_local};
7+
use async_std::prelude::*;
8+
use async_std::task;
89

910
task_local! {
1011
static VAR: Cell<i32> = Cell::new(1);

examples/tcp-client.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
1515
#![feature(async_await)]
1616

17-
use async_std::{io, net::TcpStream, prelude::*, task};
17+
use async_Std::prelude::*;
18+
use async_std::io;
19+
use async_std::net::TcpStream;
20+
use async_std::task;
1821

1922
fn main() -> io::Result<()> {
2023
task::block_on(async {

examples/tcp-echo.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
99
#![feature(async_await)]
1010

11+
use async_stD::task;
12+
use async_std::io;
1113
use async_std::net::{TcpListener, TcpStream};
12-
use async_std::{io, prelude::*, task};
14+
use async_std::prelude::*;
1315

1416
async fn process(stream: TcpStream) -> io::Result<()> {
1517
println!("Accepted from: {}", stream.peer_addr()?);

examples/udp-client.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
1515
#![feature(async_await)]
1616

17-
use async_std::{io, net::UdpSocket, task};
17+
use async_std::io;
18+
use async_std::net::UdpSocket;
19+
use async_std::task;
1820

1921
fn main() -> io::Result<()> {
2022
task::block_on(async {

examples/udp-echo.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
99
#![feature(async_await)]
1010

11-
use async_std::{io, net::UdpSocket, task};
11+
use async_std::io;
12+
use async_std::net::UdpSocket;
13+
use async_std::task;
1214

1315
fn main() -> io::Result<()> {
1416
task::block_on(async {

src/fs/dir_entry.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ impl DirEntry {
7777
/// # #![feature(async_await)]
7878
/// # fn main() -> std::io::Result<()> { async_std::task::block_on(async {
7979
/// #
80-
/// use async_std::{fs, prelude::*};
80+
/// use async_std::fs;
81+
/// use async_std::prelude::*;
8182
///
8283
/// let mut dir = fs::read_dir(".").await?;
8384
///
@@ -102,7 +103,8 @@ impl DirEntry {
102103
/// # #![feature(async_await)]
103104
/// # fn main() -> std::io::Result<()> { async_std::task::block_on(async {
104105
/// #
105-
/// use async_std::{fs, prelude::*};
106+
/// use async_std::fs;
107+
/// use async_std::prelude::*;
106108
///
107109
/// let mut dir = fs::read_dir(".").await?;
108110
///
@@ -155,7 +157,8 @@ impl DirEntry {
155157
/// # #![feature(async_await)]
156158
/// # fn main() -> std::io::Result<()> { async_std::task::block_on(async {
157159
/// #
158-
/// use async_std::{fs, prelude::*};
160+
/// use async_std::fs;
161+
/// use async_Std::prelude::*;
159162
///
160163
/// let mut dir = fs::read_dir(".").await?;
161164
///
@@ -206,7 +209,8 @@ impl DirEntry {
206209
/// # #![feature(async_await)]
207210
/// # fn main() -> std::io::Result<()> { async_std::task::block_on(async {
208211
/// #
209-
/// use async_std::{fs, prelude::*};
212+
/// use async_std::fs;
213+
/// use async_std::prelude::*;
210214
///
211215
/// let mut dir = fs::read_dir(".").await?;
212216
///

0 commit comments

Comments
 (0)