mirror of https://github.com/kdl-org/kdl-rs.git
clippy fix and fmt
This commit is contained in:
parent
014c7c57a2
commit
cbadb35764
|
|
@ -245,15 +245,15 @@ impl KdlDocument {
|
|||
|
||||
/// Formats the document according to `config`.
|
||||
pub fn autoformat_config(&mut self, config: &FormatConfig<'_>) {
|
||||
if let Some(KdlDocumentFormat { leading, .. }) = (&mut *self).format_mut() {
|
||||
if let Some(KdlDocumentFormat { leading, .. }) = (*self).format_mut() {
|
||||
crate::fmt::autoformat_leading(leading, config);
|
||||
}
|
||||
let mut has_nodes = false;
|
||||
for node in &mut (&mut *self).nodes {
|
||||
for node in &mut self.nodes {
|
||||
has_nodes = true;
|
||||
node.autoformat_config(config);
|
||||
}
|
||||
if let Some(KdlDocumentFormat { trailing, .. }) = (&mut *self).format_mut() {
|
||||
if let Some(KdlDocumentFormat { trailing, .. }) = (*self).format_mut() {
|
||||
crate::fmt::autoformat_trailing(trailing, config.no_comments);
|
||||
if !has_nodes {
|
||||
trailing.push('\n');
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ impl<'a> FormatConfigBuilder<'a> {
|
|||
|
||||
/// The indentation to use at each level.
|
||||
/// Defaults to four spaces if not specified.
|
||||
pub const fn indent<'b>(self, indent: &'b str) -> FormatConfigBuilder<'b> {
|
||||
pub const fn indent(self, indent: &str) -> FormatConfigBuilder<'_> {
|
||||
FormatConfigBuilder(FormatConfig { indent, ..self.0 })
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
//!
|
||||
//! This crate supports parsing [KDL
|
||||
//! 2.0.0-draft.6](https://github.com/kdl-org/kdl/releases/tag/2.0.0-draft.6)
|
||||
//!
|
||||
//!
|
||||
//! ## Example
|
||||
//!
|
||||
//! ```rust
|
||||
|
|
|
|||
Loading…
Reference in New Issue