Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
asymmetric committed Mar 23, 2023
1 parent a2351cd commit 66a63ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/commonmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! This module implements CommonMark output for a struct
//! representing a single entry in the manual.

use std::io::Write;

use failure::Error;

/// Represent a single function argument name and its (optional)
Expand Down Expand Up @@ -91,7 +91,7 @@ impl ManualEntry {
/// Write a single CommonMark entry for a documented Nix function.
pub fn write_section(self) -> Result<(), Error> {
let title = format!("lib.{}.{}", self.category, self.name);
let ident = format!("lib.{}.{}", self.category, self.name.replace("'", "-prime"));
let ident = format!("lib.{}.{}", self.category, self.name.replace('\'', "-prime"));

println!("## `{}` {{#function-library-{}}}\n", title, ident);

Expand Down
16 changes: 8 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//! * extract line number & add it to generated output
//! * figure out how to specify examples (& leading whitespace?!)

#[macro_use] extern crate structopt;
extern crate structopt;
extern crate failure;
extern crate rnix;

Expand All @@ -32,7 +32,7 @@ use rnix::parser::{Arena, ASTNode, ASTKind, Data};
use rnix::tokenizer::Meta;
use rnix::tokenizer::Trivia;
use std::fs;
use std::io;

use std::path::PathBuf;
use structopt::StructOpt;

Expand Down Expand Up @@ -83,7 +83,7 @@ fn retrieve_doc_comment(allow_single_line: bool, meta: &Meta) -> Option<String>
}
}

return None;
None
}

/// Transforms an AST node into a `DocItem` if it has a leading
Expand All @@ -100,7 +100,7 @@ fn retrieve_doc_item(node: &ASTNode) -> Option<DocItem> {
})
}

return None;
None
}

/// *Really* dumb, mutable, hacky doc comment "parser".
Expand Down Expand Up @@ -138,7 +138,7 @@ fn parse_doc_comment(raw: &str) -> DocComment {
}
}

let f = |s: String| if s.is_empty() { None } else { Some(s.into()) };
let f = |s: String| if s.is_empty() { None } else { Some(s) };

DocComment {
doc: doc.trim().into(),
Expand All @@ -148,7 +148,7 @@ fn parse_doc_comment(raw: &str) -> DocComment {
}

/// Traverse a pattern argument, collecting its argument names.
fn collect_pattern_args<'a>(arena: &Arena<'a>,
fn collect_pattern_args(arena: &Arena,
entry: &ASTNode,
args: &mut Vec<SingleArg>) -> Option<()> {
if let Data::Ident(meta, name) = &arena[entry.node.child?].data {
Expand Down Expand Up @@ -178,7 +178,7 @@ fn collect_pattern_args<'a>(arena: &Arena<'a>,
/// immediate child that is the identifier of its argument. The "body"
/// of the lambda is two steps to the right from that identifier, if
/// it is a lambda the function is curried and we can recurse.
fn collect_lambda_args<'a>(arena: &Arena<'a>,
fn collect_lambda_args(arena: &Arena,
lambda_node: &ASTNode,
args: &mut Vec<Argument>) -> Option<()> {
let ident_node = &arena[lambda_node.node.child?];
Expand Down Expand Up @@ -227,7 +227,7 @@ fn collect_lambda_args<'a>(arena: &Arena<'a>,
/// 2. The attached doc comment on the entry.
/// 3. The argument names of any curried functions (pattern functions
/// not yet supported).
fn collect_entry_information<'a>(arena: &Arena<'a>, entry_node: &ASTNode) -> Option<DocItem> {
fn collect_entry_information(arena: &Arena, entry_node: &ASTNode) -> Option<DocItem> {
// The "root" of any attribute set entry is this `SetEntry` node.
// It has an `Attribute` child, which in turn has the identifier
// (on which the documentation comment is stored) as its child.
Expand Down

0 comments on commit 66a63ce

Please sign in to comment.