diff --git a/README.md b/README.md index 3dd4a5b..733decd 100644 --- a/README.md +++ b/README.md @@ -63,10 +63,8 @@ use log::warn; use systemd::{journal, sd_journal_log}; fn main() { - use systemd::journal; - journal::print(1, &format!("Rust can talk to the journal: {:?}", - 4)); - journal::send(["CODE_FILE=HI", "CODE_LINE=1213", "CODE_FUNCTION=LIES"]); + journal::print(1, &format!("Rust can talk to the journal: {:?}", 4)); + journal::send(&["CODE_FILE=HI", "CODE_LINE=1213", "CODE_FUNCTION=LIES"]); journal::JournalLog::init().unwrap(); warn!("HI"); sd_journal_log!(4, "HI {:?}", 2); diff --git a/src/lib.rs b/src/lib.rs index 0276a42..2fd0ee2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,9 @@ #![cfg_attr(feature = "unstable-doc-cfg", feature(doc_cfg))] #![warn(rust_2018_idioms)] +#[cfg(all(feature = "journal", doctest))] +doc_comment::doctest!("../README.md", readme); + extern crate libsystemd_sys as ffi; /* diff --git a/tests/readme.rs b/tests/readme.rs deleted file mode 100644 index 64e40fc..0000000 --- a/tests/readme.rs +++ /dev/null @@ -1,3 +0,0 @@ -use doc_comment::doctest; - -doctest!("../README.md");