Skip to content

Commit

Permalink
Fix warnings in doc comments
Browse files Browse the repository at this point in the history
Add automatic link markup to urls

Escape square brackets comments containing "[INFO]", "[WARNING]", "[ERROR]"
  • Loading branch information
AntonHermann committed Nov 12, 2021
1 parent 9238b8e commit f92c1e3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub type Result<T> = std::result::Result<T, Error>;
/// Pretty final error message for end users, crashing the program after display.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct FinalError {
/// Should be made of just one line, appears after the "[ERROR]" part
/// Should be made of just one line, appears after the "\[ERROR\]" part
title: String,
/// Shown as a unnumbered list in yellow
details: Vec<String>,
Expand Down
8 changes: 4 additions & 4 deletions src/macros.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Macros used on ouch.

/// Macro that prints [INFO] messages, wraps [`println`].
/// Macro that prints \[INFO\] messages, wraps [`println`].
#[macro_export]
macro_rules! info {
($($arg:tt)*) => {
Expand All @@ -9,14 +9,14 @@ macro_rules! info {
};
}

/// Helper to display "[INFO]", colored yellow
/// Helper to display "\[INFO\]", colored yellow
pub fn _info_helper() {
use crate::utils::colors::{RESET, YELLOW};

print!("{}[INFO]{} ", *YELLOW, *RESET);
}

/// Macro that prints [WARNING] messages, wraps [`println`].
/// Macro that prints \[WARNING\] messages, wraps [`println`].
#[macro_export]
macro_rules! warning {
($($arg:tt)*) => {
Expand All @@ -25,7 +25,7 @@ macro_rules! warning {
};
}

/// Helper to display "[INFO]", colored yellow
/// Helper to display "\[WARNING\]", colored orange
pub fn _warning_helper() {
use crate::utils::colors::{ORANGE, RESET};

Expand Down
4 changes: 2 additions & 2 deletions src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use clap::{Parser, ValueHint};
///
/// Supported formats: tar, zip, bz/bz2, gz, lz4, xz/lz/lzma, zst.
///
/// Repository: https://github.com/ouch-org/ouch
/// Repository: <https://github.com/ouch-org/ouch>
#[derive(Parser, Debug)]
#[clap(version)]
pub struct Opts {
Expand All @@ -26,7 +26,7 @@ pub struct Opts {

// CAREFUL: this docs can accidentally become part of the --help message if they get too long
// this was tested in clap 3.0.0-beta5.
/// Repository: https://github.com/ouch-org/ouch
/// Repository: <https://github.com/ouch-org/ouch>
//
// Ouch commands:
// - `compress`
Expand Down
2 changes: 1 addition & 1 deletion src/utils/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{
///
/// This is different from [`Path::display`].
///
/// See https://gist.github.com/marcospb19/ebce5572be26397cf08bbd0fd3b65ac1 for a comparison.
/// See <https://gist.github.com/marcospb19/ebce5572be26397cf08bbd0fd3b65ac1> for a comparison.
pub fn to_utf(os_str: impl AsRef<OsStr>) -> String {
let text = format!("{:?}", os_str.as_ref());
text.trim_matches('"').to_string()
Expand Down
2 changes: 1 addition & 1 deletion src/utils/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn cd_into_same_dir_as(filename: &Path) -> crate::Result<PathBuf> {
}

/// Try to detect the file extension by looking for known magic strings
/// Source: https://en.wikipedia.org/wiki/List_of_file_signatures
/// Source: <https://en.wikipedia.org/wiki/List_of_file_signatures>
pub fn try_infer_extension(path: &Path) -> Option<Extension> {
fn is_zip(buf: &[u8]) -> bool {
buf.len() >= 3
Expand Down

0 comments on commit f92c1e3

Please sign in to comment.