Skip to content

Commit 93a732d

Browse files
committed
chore: address lints in emmylua_doc_cli
1 parent a0cd8e9 commit 93a732d

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

crates/emmylua_doc_cli/src/init.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ use emmylua_code_analysis::{
33
};
44
use fern::Dispatch;
55
use log::LevelFilter;
6-
use std::{path::PathBuf, str::FromStr, sync::Arc};
6+
use std::{
7+
path::{Path, PathBuf},
8+
str::FromStr,
9+
sync::Arc,
10+
};
711

8-
fn root_from_configs(config_paths: &Vec<PathBuf>, fallback: &PathBuf) -> PathBuf {
12+
fn root_from_configs(config_paths: &[PathBuf], fallback: &Path) -> PathBuf {
913
if config_paths.len() != 1 {
10-
fallback.clone()
14+
fallback.to_path_buf()
1115
} else {
1216
let config_path = &config_paths[0];
1317
// Need to convert to canonical path to ensure parent() is not an empty
@@ -20,7 +24,7 @@ fn root_from_configs(config_paths: &Vec<PathBuf>, fallback: &PathBuf) -> PathBuf
2024
config_path,
2125
err
2226
);
23-
fallback.clone()
27+
fallback.to_path_buf()
2428
}
2529
}
2630
}

crates/emmylua_doc_cli/src/markdown_generator/generator/index_gen.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ use tera::Tera;
22

33
use crate::markdown_generator::markdown_types::MkdocsIndex;
44

5-
pub fn generate_index(
6-
tl: &Tera,
7-
mkdocs: &mut MkdocsIndex,
8-
output: &std::path::PathBuf,
9-
) -> Option<()> {
5+
pub fn generate_index(tl: &Tera, mkdocs: &mut MkdocsIndex, output: &std::path::Path) -> Option<()> {
106
let mut context = tera::Context::new();
117
mkdocs.types.sort_by(|a, b| a.name.cmp(&b.name));
128
mkdocs.modules.sort_by(|a, b| a.name.cmp(&b.name));

crates/emmylua_doc_cli/src/markdown_generator/generator/mod_gen.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ pub fn generate_module_markdown(
2525
check_filter(db, module.file_id)?;
2626

2727
let mut context = tera::Context::new();
28-
let mut doc = Doc::default();
29-
doc.name = module.full_module_name.clone();
28+
let mut doc = Doc {
29+
name: module.full_module_name.clone(),
30+
..Default::default()
31+
};
3032
let property_owner_id = module.semantic_id.clone();
3133
if let Some(property_id) = property_owner_id {
3234
doc.property = collect_property(db, property_id);

crates/emmylua_doc_cli/src/markdown_generator/generator/typ_gen.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ pub fn generate_type_markdown(
2323
check_filter(db, typ)?;
2424
let mut context = tera::Context::new();
2525
let typ_name = typ.get_name();
26-
let mut doc = Doc::default();
27-
doc.name = typ_name.to_string();
26+
let mut doc = Doc {
27+
name: typ_name.to_string(),
28+
..Default::default()
29+
};
2830

2931
if typ.is_class() {
3032
generate_class_type_markdown(db, tl, typ, &mut doc, &mut context, output, mkdocs_index);

0 commit comments

Comments
 (0)