Apply suggestions from clippy.
This commit is contained in:
parent
873bd85d8b
commit
ac0d180c5c
|
@ -10,7 +10,7 @@ use pulldown_cmark as markdown;
|
|||
use serde::Serialize;
|
||||
use serde_json as json;
|
||||
use std::{
|
||||
path::PathBuf,
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
time::{Duration, SystemTime},
|
||||
};
|
||||
|
@ -75,7 +75,7 @@ struct SearchIndex {
|
|||
/// The documentation is built using template files located at the root of this crate.
|
||||
/// With the documentation, we also build a client-side search index to ease navigation
|
||||
/// across multiple modules.
|
||||
pub fn generate_all(root: &PathBuf, config: &Config, modules: Vec<&CheckedModule>) -> Vec<DocFile> {
|
||||
pub fn generate_all(root: &Path, config: &Config, modules: Vec<&CheckedModule>) -> Vec<DocFile> {
|
||||
let timestamp = new_timestamp();
|
||||
let modules_links = generate_modules_links(&modules);
|
||||
|
||||
|
@ -243,7 +243,7 @@ fn generate_static_assets(search_indexes: Vec<SearchIndex>) -> Vec<DocFile> {
|
|||
}
|
||||
|
||||
fn generate_readme(
|
||||
root: &PathBuf,
|
||||
root: &Path,
|
||||
config: &Config,
|
||||
modules: &Vec<DocLink>,
|
||||
timestamp: &Duration,
|
||||
|
@ -414,13 +414,10 @@ struct DocTypeConstructorArg {
|
|||
|
||||
impl DocTypeConstructorArg {
|
||||
fn from_record_constructor_arg(arg: &RecordConstructorArg<Arc<Type>>) -> Option<Self> {
|
||||
match &arg.label {
|
||||
None => None,
|
||||
Some(label) => Some(DocTypeConstructorArg {
|
||||
arg.label.as_ref().map(|label| DocTypeConstructorArg {
|
||||
label: label.clone(),
|
||||
documentation: arg.doc.as_deref().map(render_markdown).unwrap_or_default(),
|
||||
}),
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ where
|
|||
});
|
||||
self.read_source_files()?;
|
||||
|
||||
let destination = destination.unwrap_or(self.root.join("doc"));
|
||||
let destination = destination.unwrap_or_else(|| self.root.join("doc"));
|
||||
let mut parsed_modules = self.parse_sources()?;
|
||||
for (_, module) in parsed_modules.iter_mut() {
|
||||
module.attach_doc_and_module_comments();
|
||||
|
@ -120,7 +120,7 @@ where
|
|||
docs::generate_all(&self.root, &self.config, checked_modules.values().collect());
|
||||
for file in doc_files {
|
||||
let path = destination.join(file.path);
|
||||
fs::create_dir_all(&path.parent().unwrap())?;
|
||||
fs::create_dir_all(path.parent().unwrap())?;
|
||||
fs::write(&path, file.content)?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue