Repository: J-F-Liu/lopdf (language: rust)

Issue:
lopdf 0.35.0 fails to build with default_features = false
Steps to reproduce:

```
$ cargo new lopdf-test
$ cd lopdf-test
$ cargo add lopdf@=0.35.0 --no-default-features
$ cargo build
...
error[E0433]: failed to resolve: use of undeclared crate or module `nom`
 --> /home/sebastian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lopdf-0.35.0/src/parser/cmap_parser.rs:3:5
  |
3 | use nom::branch::alt;
  |     ^^^ use of undeclared crate or module `nom`

... <long list of errors>
```

workaround: `cargo add lopdf@=0.35.0 --no-default-features --features nom_parser`

Related to #226
lopdf 0.35.0 fails to build with default_features = false
Steps to reproduce:

```
$ cargo new lopdf-test
$ cd lopdf-test
$ cargo add lopdf@=0.35.0 --no-default-features
$ cargo build
...
error[E0433]: failed to resolve: use of undeclared crate or module `nom`
 --> /home/sebastian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lopdf-0.35.0/src/parser/cmap_parser.rs:3:5
  |
3 | use nom::branch::alt;
  |     ^^^ use of undeclared crate or module `nom`

... <long list of errors>
```

workaround: `cargo add lopdf@=0.35.0 --no-default-features --features nom_parser`

Related to #226


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0207fc2..9f4040f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,7 +18,6 @@ jobs:
                     - nightly
                     - "feat: no default features"
                     - "feat: all features"
-                    - "feat: nom only"
 
                 include:
                     - name: beta
@@ -29,8 +28,6 @@ jobs:
 
                     - name: "feat: all features"
                       features: "--all-features"
-                    - name: "feat: nom only"
-                      features: "--no-default-features --features nom_parser"
 
         steps:
             - uses: actions/checkout@v2
diff --git a/Cargo.toml b/Cargo.toml
index 8f47b34..b47ffbe 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -31,8 +31,8 @@ itoa = "1.0"
 jiff = { version = "0.2", optional = true }
 log = "0.4"
 md-5 = "0.10"
-nom = { version = "7.1", optional = true }
-nom_locate = { version = "4.2.0", optional = true }
+nom = "7.1"
+nom_locate = "4.2.0"
 rand = { version = "0.9" }
 rangemap = "1.5"
 rayon = { version = "1.6", optional = true }
@@ -52,10 +52,9 @@ tempfile = "3.3"
 [features]
 async = ["tokio/rt-multi-thread", "tokio/macros"]
 chrono = ["dep:chrono"]
-default = ["chrono", "jiff", "nom_parser", "rayon", "time"]
+default = ["chrono", "jiff", "rayon", "time"]
 embed_image = ["image"]
 jiff = ["dep:jiff"]
-nom_parser = ["nom", "nom_locate"]
 serde = ["dep:serde"]
 time = ["dep:time"]
 
diff --git a/src/lib.rs b/src/lib.rs
index d29e7ed..6cfff75 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -43,6 +43,5 @@ pub use error::{Error, Result};
 pub use incremental_document::IncrementalDocument;
 pub use object_stream::ObjectStream;
 pub use outlines::Outline;
-#[cfg(feature = "nom_parser")]
 pub use reader::Reader;
 pub use toc::Toc;
diff --git a/src/object_stream.rs b/src/object_stream.rs
index 2c49aff..f725432 100644
--- a/src/object_stream.rs
+++ b/src/object_stream.rs
@@ -1,4 +1,3 @@
-#[cfg(feature = "nom_parser")]
 use crate::parser::{self, ParserInput};
 use crate::{Error, Object, ObjectId, Result, Stream};
 use std::collections::BTreeMap;
diff --git a/src/parser/mod.rs b/src/parser/mod.rs
index 855e378..39a3e51 100644
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -1,4 +1,3 @@
-#[cfg(feature = "nom_parser")]
 use super::{Dictionary, Object, ObjectId, Reader, Stream, StringFormat};
 use crate::content::*;
 use crate::error;
diff --git a/src/parser_aux.rs b/src/parser_aux.rs
index 4ae8b42..46375da 100644
--- a/src/parser_aux.rs
+++ b/src/parser_aux.rs
@@ -1,4 +1,3 @@
-#![cfg(feature = "nom_parser")]
 use log::warn;
 
 use crate::{
diff --git a/src/reader.rs b/src/reader.rs
index 6428504..cc6b144 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -1,4 +1,3 @@
-#[cfg(feature = "nom_parser")]
 use log::{error, warn};
 use std::cmp;
 use std::collections::{BTreeMap, HashSet};
diff --git a/src/xref.rs b/src/xref.rs
index 0165486..a061f59 100644
--- a/src/xref.rs
+++ b/src/xref.rs
@@ -137,5 +137,4 @@ impl XrefSection {
     }
 }
 
-#[cfg(feature = "nom_parser")]
 pub use crate::parser_aux::decode_xref_stream;


Test patch: