diff --git a/clippy.toml b/clippy.toml index 7f7ae210..39e6cc64 100644 --- a/clippy.toml +++ b/clippy.toml @@ -2,3 +2,4 @@ disallowed-methods = [ { path = "std::env::var_os", reason = "Please use Build::getenv" }, { path = "std::env::var", reason = "Please use Build::getenv" }, ] +doc-valid-idents = ["AppleClang", "OpenBSD", ".."] diff --git a/src/command_helpers.rs b/src/command_helpers.rs index 7caa3a21..910d0682 100644 --- a/src/command_helpers.rs +++ b/src/command_helpers.rs @@ -29,11 +29,11 @@ pub(crate) struct CargoOutput { /// Different strategies for handling compiler output (to stdout) #[derive(Clone, Debug)] pub(crate) enum OutputKind { - /// Forward the output to this process' stdout (Stdio::inherit) + /// Forward the output to this process' stdout ([`Stdio::inherit()`]) Forward, - /// Discard the output (Stdio::null) + /// Discard the output ([`Stdio::null()`]) Discard, - /// Capture the result + /// Capture the result (`[Stdio::piped()`]) Capture, } diff --git a/src/lib.rs b/src/lib.rs index 27b5586d..218b9e04 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -210,6 +210,7 @@ #![deny(warnings)] #![deny(missing_docs)] #![deny(clippy::disallowed_methods)] +#![warn(clippy::doc_markdown)] use std::borrow::Cow; use std::collections::HashMap; @@ -1277,7 +1278,8 @@ impl Build { /// Run the compiler, generating the file `output` /// - /// This will return a result instead of panicking; see compile() for the complete description. + /// This will return a result instead of panicking; see [`Self::compile()`] for + /// the complete description. pub fn try_compile(&self, output: &str) -> Result<(), Error> { let mut output_components = Path::new(output).components(); match (output_components.next(), output_components.next()) { @@ -1716,7 +1718,8 @@ impl Build { Ok((cmd, name)) } - /// This will return a result instead of panicking; see expand() for the complete description. + /// This will return a result instead of panicking; see [`Self::expand()`] for + /// the complete description. pub fn try_expand(&self) -> Result, Error> { let compiler = self.try_get_compiler()?; let mut cmd = compiler.to_command(); @@ -2470,14 +2473,14 @@ impl Build { cmd.arg("-PreDefine"); if let Some(ref value) = *value { if let Ok(i) = value.parse::() { - cmd.arg(&format!("{} SETA {}", key, i)); + cmd.arg(format!("{} SETA {}", key, i)); } else if value.starts_with('"') && value.ends_with('"') { - cmd.arg(&format!("{} SETS {}", key, value)); + cmd.arg(format!("{} SETS {}", key, value)); } else { - cmd.arg(&format!("{} SETS \"{}\"", key, value)); + cmd.arg(format!("{} SETS \"{}\"", key, value)); } } else { - cmd.arg(&format!("{} SETL {}", key, "{TRUE}")); + cmd.arg(format!("{} SETL {}", key, "{TRUE}")); } } } else { @@ -2487,9 +2490,9 @@ impl Build { for (key, value) in self.definitions.iter() { if let Some(ref value) = *value { - cmd.arg(&format!("-D{}={}", key, value)); + cmd.arg(format!("-D{}={}", key, value)); } else { - cmd.arg(&format!("-D{}", key)); + cmd.arg(format!("-D{}", key)); } } } @@ -4016,7 +4019,7 @@ impl Build { // clang driver appears to be forcing UTF-8 output even on Windows, // hence from_utf8 is assumed to be usable in all cases. let search_dirs = std::str::from_utf8(&search_dirs).ok()?; - for dirs in search_dirs.split(|c| c == '\r' || c == '\n') { + for dirs in search_dirs.split(['\r', '\n']) { if let Some(path) = dirs.strip_prefix("programs: =") { return self.which(prog, Some(OsStr::new(path))); }