Skip to content

Commit 99dec9f

Browse files
committed
feat(api): unflagged ensure_v2 fns, and docsrs improvements
1 parent 5aa81f8 commit 99dec9f

File tree

7 files changed

+17
-12
lines changed

7 files changed

+17
-12
lines changed

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,10 @@ kdlv1 = { package = "kdl", version = "4.7.0", optional = true }
2727
[dev-dependencies]
2828
miette = { version = "7.2.0", features = ["fancy"] }
2929
pretty_assertions = "1.3.0"
30+
31+
# docs.rs-specific configuration
32+
[package.metadata.docs.rs]
33+
# document all features
34+
all-features = true
35+
# defines the configuration attribute `docsrs`
36+
rustdoc-args = ["--cfg", "docsrs"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ You must be at least `1.70.0` tall to get on this ride.
147147
### License
148148

149149
The code in this repository is covered by [the Apache-2.0
150-
License](LICENSE).
150+
License](./LICENSE).
151151

152152
[`KdlDocument`]: https://docs.rs/kdl/latest/kdl/struct.KdlDocument.html
153153
[`KdlNode`]: https://docs.rs/kdl/latest/kdl/struct.KdlNode.html

src/document.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl KdlDocument {
221221
/// Clears leading and trailing text (whitespace, comments). `KdlNode`s in
222222
/// this document will be unaffected.
223223
///
224-
/// If you need to clear the `KdlNode`s, use [`Self::clear_fmt_recursive`].
224+
/// If you need to clear the `KdlNode`s, use [`Self::clear_format_recursive`].
225225
pub fn clear_format(&mut self) {
226226
self.format = None;
227227
}
@@ -385,7 +385,6 @@ impl KdlDocument {
385385
}
386386

387387
/// Makes sure this document is in v2 format.
388-
#[cfg(feature = "v1")]
389388
pub fn ensure_v2(&mut self) {
390389
// No need to touch KdlDocumentFormat, probably. In the longer term,
391390
// we'll want to make sure to parse out whitespace and comments and make

src/entry.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl KdlEntry {
8383

8484
/// Gets this entry's span.
8585
///
86-
/// This value will be properly initialized when created via [`KdlDocument::parse`]
86+
/// This value will be properly initialized when created via [`crate::KdlDocument::parse`]
8787
/// but may become invalidated if the document is mutated. We do not currently
8888
/// guarantee this to yield any particularly consistent results at that point.
8989
#[cfg(feature = "span")]
@@ -221,7 +221,6 @@ impl KdlEntry {
221221
}
222222

223223
/// Makes sure this entry is in v2 format.
224-
#[cfg(feature = "v1")]
225224
pub fn ensure_v2(&mut self) {
226225
let value_repr = self.format.as_ref().map(|x| {
227226
match &self.value {

src/identifier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl KdlIdentifier {
4242

4343
/// Gets this identifier's span.
4444
///
45-
/// This value will be properly initialized when created via [`KdlDocument::parse`]
45+
/// This value will be properly initialized when created via [`crate::KdlDocument::parse`]
4646
/// but may become invalidated if the document is mutated. We do not currently
4747
/// guarantee this to yield any particularly consistent results at that point.
4848
#[cfg(feature = "span")]

src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,16 @@
104104
//! ```
105105
//!
106106
//! ## Features
107-
//!
108-
//! * `span` (default) - Includes spans in the various document-related structs.
107+
//!
108+
//! * `span` (default) - Includes spans in the various document-related structs.
109109
//! * `v1` - Adds support for v1 parsing. This will pull in the entire previous
110110
//! version of `kdl-rs`, and so may be fairly heavy.
111111
//! * `v1-fallback` - Implies `v1`. Makes it so the various `*::parse()` and
112112
//! `FromStr` implementations try to parse their inputs as `v2`, and, if that
113113
//! fails, try again with `v1`. Errors will only be reported as if the input was
114114
//! `v2`. To manage this more precisely, you can use the `*::parse_v2` and
115115
//! `*::parse_v1` methods.
116-
//!
116+
//!
117117
//! ## Quirks
118118
//!
119119
//! ### Properties
@@ -145,7 +145,7 @@
145145
//! ## License
146146
//!
147147
//! The code in this repository is covered by [the Apache-2.0
148-
//! License](LICENSE).
148+
//! License](./LICENSE).
149149
150150
// TODO(@zkat): bring this back later.
151151
// ### Query Engine
@@ -183,6 +183,7 @@
183183
#![deny(missing_debug_implementations, nonstandard_style)]
184184
#![warn(missing_docs, rust_2018_idioms, unreachable_pub)]
185185
#![cfg_attr(test, deny(warnings))]
186+
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
186187
#![doc(html_favicon_url = "https://kdl.dev/favicon.ico")]
187188
#![doc(html_logo_url = "https://kdl.dev/logo.svg")]
188189

src/node.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl KdlNode {
130130
/// their formatting will be preserved.
131131
///
132132
/// If you want to clear formatting on all children and entries as well,
133-
/// use [`Self::clear_fmt_recursive`].
133+
/// use [`Self::clear_format_recursive`].
134134
pub fn clear_format(&mut self) {
135135
self.format = None;
136136
}
@@ -355,7 +355,6 @@ impl KdlNode {
355355
}
356356

357357
/// Makes sure this node is in v2 format.
358-
#[cfg(feature = "v1")]
359358
pub fn ensure_v2(&mut self) {
360359
self.ty = self.ty.take().map(|ty| ty.value().into());
361360
let v2_name: KdlIdentifier = self.name.value().into();

0 commit comments

Comments
 (0)