Skip to content

Commit f55ba47

Browse files
committed
Fix doctest
Apparently, no_compile doesn't prevent the doctest from being compiled
1 parent d1393e3 commit f55ba47

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

core/lib/src/fs/server.rs

+14-5
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,20 @@ impl FileServer {
335335
///
336336
/// # Example
337337
///
338-
/// ```rust,no_compile
339-
/// # // TODO: turn this into a proper test
340-
/// FileServer::new("static/", Options::None)
341-
/// .rewrite(NormalizeDirs)
342-
/// .rewrite(Index::default())
338+
/// ```rust,no_run
339+
/// # #[macro_use] extern crate rocket;
340+
/// use rocket::fs::{FileServer, Options, NormalizeDirs, Index};
341+
///
342+
/// #[launch]
343+
/// fn rocket() -> _ {
344+
/// rocket::build()
345+
/// .mount("/static", FileServer::from("/www/public"))
346+
/// .mount("/pub",
347+
/// FileServer::new("/www/public", Options::None)
348+
/// .rewrite(NormalizeDirs)
349+
/// .rewrite(Index::default())
350+
/// )
351+
/// }
343352
/// ```
344353
/// In this example, order actually does matter. [`NormalizeDirs`] will convert a path to a
345354
/// directory without a trailing slash into a redirect to the same path, but with the trailing

0 commit comments

Comments
 (0)