add lints, docstrings
This commit is contained in:
@@ -5,6 +5,8 @@ This library contains all logic that happens in `pacdef` under the hood.
|
|||||||
#![warn(
|
#![warn(
|
||||||
clippy::as_conversions,
|
clippy::as_conversions,
|
||||||
clippy::cognitive_complexity,
|
clippy::cognitive_complexity,
|
||||||
|
clippy::missing_errors_doc,
|
||||||
|
clippy::missing_panics_doc,
|
||||||
clippy::option_if_let_else,
|
clippy::option_if_let_else,
|
||||||
clippy::redundant_pub_crate,
|
clippy::redundant_pub_crate,
|
||||||
clippy::semicolon_if_nothing_returned,
|
clippy::semicolon_if_nothing_returned,
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ const CONFIG_FILE_NAME: &str = "pacdef.yaml";
|
|||||||
|
|
||||||
/// Get the group directory where all group files are located. This is
|
/// Get the group directory where all group files are located. This is
|
||||||
/// `$XDG_CONFIG_HOME/pacdef/groups`, which defaults to `$HOME/.config/pacdef/groups`.
|
/// `$XDG_CONFIG_HOME/pacdef/groups`, which defaults to `$HOME/.config/pacdef/groups`.
|
||||||
|
///
|
||||||
|
/// # Errors
|
||||||
|
///
|
||||||
|
/// This function returns an error if both `$XDG_CONFIG_HOME` and `$HOME` are undefined.
|
||||||
pub fn get_group_dir() -> Result<PathBuf> {
|
pub fn get_group_dir() -> Result<PathBuf> {
|
||||||
let mut result = get_pacdef_base_dir().context("getting pacdef base dir")?;
|
let mut result = get_pacdef_base_dir().context("getting pacdef base dir")?;
|
||||||
result.push("groups");
|
result.push("groups");
|
||||||
@@ -35,6 +39,10 @@ pub fn get_home_dir() -> Result<PathBuf> {
|
|||||||
|
|
||||||
/// Get the group directory where all group files are located. This is
|
/// Get the group directory where all group files are located. This is
|
||||||
/// `$XDG_CONFIG_HOME/pacdef/pacdef.yaml`.
|
/// `$XDG_CONFIG_HOME/pacdef/pacdef.yaml`.
|
||||||
|
///
|
||||||
|
/// # Errors
|
||||||
|
///
|
||||||
|
/// This function returns an error if both `$XDG_CONFIG_HOME` and `$HOME` are undefined.
|
||||||
pub fn get_config_path() -> Result<PathBuf> {
|
pub fn get_config_path() -> Result<PathBuf> {
|
||||||
let mut file = get_pacdef_base_dir().context("getting pacdef base dir for config file")?;
|
let mut file = get_pacdef_base_dir().context("getting pacdef base dir for config file")?;
|
||||||
file.push(CONFIG_FILE_NAME);
|
file.push(CONFIG_FILE_NAME);
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
/*!
|
/*!
|
||||||
Procedural macros for `pacdef`.
|
Procedural macros for `pacdef`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#![warn(
|
#![warn(
|
||||||
clippy::as_conversions,
|
clippy::as_conversions,
|
||||||
clippy::cognitive_complexity,
|
clippy::cognitive_complexity,
|
||||||
|
clippy::missing_errors_doc,
|
||||||
|
clippy::missing_panics_doc,
|
||||||
clippy::option_if_let_else,
|
clippy::option_if_let_else,
|
||||||
clippy::redundant_pub_crate,
|
clippy::redundant_pub_crate,
|
||||||
clippy::semicolon_if_nothing_returned,
|
clippy::semicolon_if_nothing_returned,
|
||||||
|
|||||||
Reference in New Issue
Block a user