Skip to content

Commit d448215

Browse files
committed
docs: Fix: apparently can't feature-gate the declaration *and* body of an explicit main in doctest
1 parent 14e590b commit d448215

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/write.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,9 @@ impl<A: Read + Write + Seek> ZipWriter<A> {
745745
/// [`Self::finish()`].
746746
///
747747
///```
748-
/// # #[cfg(any(feature = "deflate-flate2", not(feature = "_deflate-any")))]
749748
/// # fn main() -> Result<(), zip::result::ZipError> {
749+
/// # #[cfg(any(feature = "deflate-flate2", not(feature = "_deflate-any")))]
750+
/// # {
750751
/// use std::io::{Cursor, prelude::*};
751752
/// use zip::{ZipArchive, ZipWriter, write::SimpleFileOptions};
752753
///
@@ -760,6 +761,7 @@ impl<A: Read + Write + Seek> ZipWriter<A> {
760761
/// let mut s: String = String::new();
761762
/// zip.by_name("a.txt")?.read_to_string(&mut s)?;
762763
/// assert_eq!(s, "hello\n");
764+
/// # }
763765
/// # Ok(())
764766
/// # }
765767
///```
@@ -1180,8 +1182,9 @@ impl<W: Write + Seek> ZipWriter<W> {
11801182
/// calling [`Self::raw_copy_file()`] for each entry from the `source` archive in sequence.
11811183
///
11821184
///```
1183-
/// # #[cfg(any(feature = "deflate-flate2", not(feature = "_deflate-any")))]
11841185
/// # fn main() -> Result<(), zip::result::ZipError> {
1186+
/// # #[cfg(any(feature = "deflate-flate2", not(feature = "_deflate-any")))]
1187+
/// # {
11851188
/// use std::io::{Cursor, prelude::*};
11861189
/// use zip::{ZipArchive, ZipWriter, write::SimpleFileOptions};
11871190
///
@@ -1210,6 +1213,7 @@ impl<W: Write + Seek> ZipWriter<W> {
12101213
/// s.clear();
12111214
/// result.by_name("b.txt")?.read_to_string(&mut s)?;
12121215
/// assert_eq!(s, "hey\n");
1216+
/// # }
12131217
/// # Ok(())
12141218
/// # }
12151219
///```

0 commit comments

Comments
 (0)