summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/tests/target/issue-2759.rs
blob: b7176ec66f85047b2cfe4b91cf09848242ff9986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// rustfmt-wrap_comments: true
// rustfmt-max_width: 89

// Code block in doc comments that will exceed max width.
/// ```rust
/// extern crate actix_web;
/// use actix_web::{actix, server, App, HttpResponse};
///
/// fn main() {
///     // Run actix system, this method actually starts all async processes
///     actix::System::run(|| {
///         server::new(|| App::new().resource("/", |r| r.h(|_| HttpResponse::Ok())))
///             .bind("127.0.0.1:0")
///             .expect("Can not bind to 127.0.0.1:0")
///             .start();
/// #           actix::Arbiter::system().do_send(actix::msgs::SystemExit(0));
///     });
/// }
/// ```
fn foo() {}

// Code block in doc comments without the closing '```'.
/// ```rust
/// # extern crate actix_web;
/// use actix_web::{App, HttpResponse, http};
///
/// fn main() {
///     let app = App::new()
///         .resource(
///             "/", |r| r.method(http::Method::GET).f(|r| HttpResponse::Ok()))
///         .finish();
/// }
fn bar() {}

// `#` with indent.
/// ```rust
/// # use std::thread;
/// # extern crate actix_web;
/// use actix_web::{server, App, HttpResponse};
///
/// struct State1;
///
/// struct State2;
///
/// fn main() {
///     # thread::spawn(|| {
///     server::new(|| {
///         vec![
///             App::with_state(State1)
///                 .prefix("/app1")
///                 .resource("/", |r| r.f(|r| HttpResponse::Ok()))
///                 .boxed(),
///             App::with_state(State2)
///                 .prefix("/app2")
///                 .resource("/", |r| r.f(|r| HttpResponse::Ok()))
///                 .boxed(),
///         ]
///     })
///     .bind("127.0.0.1:8080")
///     .unwrap()
///     .run()
///     # });
/// }
/// ```
fn foobar() {}