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