mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 12:38:43 +00:00
Fix clippy lints (#2111)
* Fix indentation of docs in extracted_files.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Optimize parse_header_retry_after Use next_back instead of last Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> * Fix doc indentation in cargo_config.rs Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> --------- Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
parent
9c0726d197
commit
b49bcb7a16
3 changed files with 13 additions and 13 deletions
|
@ -80,17 +80,17 @@ impl ExtractedFiles {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// * `path` - must be a relative path without `.`, `..`, `/`, `prefix:/`
|
/// * `path` - must be a relative path without `.`, `..`, `/`, `prefix:/`
|
||||||
/// and must not be empty, for these values it is guaranteed to
|
/// and must not be empty, for these values it is guaranteed to
|
||||||
/// return `None`.
|
/// return `None`.
|
||||||
/// But could be set to "." for top-level.
|
/// But could be set to "." for top-level.
|
||||||
pub fn get_entry(&self, path: &Path) -> Option<&ExtractedFilesEntry> {
|
pub fn get_entry(&self, path: &Path) -> Option<&ExtractedFilesEntry> {
|
||||||
self.0.get(path)
|
self.0.get(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// * `path` - must be a relative path without `.`, `..`, `/`, `prefix:/`
|
/// * `path` - must be a relative path without `.`, `..`, `/`, `prefix:/`
|
||||||
/// and must not be empty, for these values it is guaranteed to
|
/// and must not be empty, for these values it is guaranteed to
|
||||||
/// return `None`.
|
/// return `None`.
|
||||||
/// But could be set to "." for top-level.
|
/// But could be set to "." for top-level.
|
||||||
pub fn get_dir(&self, path: &Path) -> Option<&HashSet<Box<OsStr>>> {
|
pub fn get_dir(&self, path: &Path) -> Option<&HashSet<Box<OsStr>>> {
|
||||||
match self.get_entry(path)? {
|
match self.get_entry(path)? {
|
||||||
ExtractedFilesEntry::Dir(file_names) => Some(file_names),
|
ExtractedFilesEntry::Dir(file_names) => Some(file_names),
|
||||||
|
@ -99,9 +99,9 @@ impl ExtractedFiles {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// * `path` - must be a relative path without `.`, `..`, `/`, `prefix:/`
|
/// * `path` - must be a relative path without `.`, `..`, `/`, `prefix:/`
|
||||||
/// and must not be empty, for these values it is guaranteed to
|
/// and must not be empty, for these values it is guaranteed to
|
||||||
/// return `false`.
|
/// return `false`.
|
||||||
/// But could be set to "." for top-level.
|
/// But could be set to "." for top-level.
|
||||||
pub fn has_file(&self, path: &Path) -> bool {
|
pub fn has_file(&self, path: &Path) -> bool {
|
||||||
matches!(self.get_entry(path), Some(ExtractedFilesEntry::File))
|
matches!(self.get_entry(path), Some(ExtractedFilesEntry::File))
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,7 +390,7 @@ fn parse_header_retry_after(headers: &HeaderMap) -> Option<Duration> {
|
||||||
let header = headers
|
let header = headers
|
||||||
.get_all(RETRY_AFTER)
|
.get_all(RETRY_AFTER)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.last()?
|
.next_back()?
|
||||||
.to_str()
|
.to_str()
|
||||||
.ok()?;
|
.ok()?;
|
||||||
|
|
||||||
|
|
|
@ -86,9 +86,9 @@ impl Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// * `dir` - path to the dir where the config.toml is located.
|
/// * `dir` - path to the dir where the config.toml is located.
|
||||||
/// For relative path in the config, `Config::load_from_reader`
|
/// For relative path in the config, `Config::load_from_reader`
|
||||||
/// will join the `dir` and the relative path to form the final
|
/// will join the `dir` and the relative path to form the final
|
||||||
/// path.
|
/// path.
|
||||||
pub fn load_from_reader<R: io::Read>(
|
pub fn load_from_reader<R: io::Read>(
|
||||||
mut reader: R,
|
mut reader: R,
|
||||||
dir: &Path,
|
dir: &Path,
|
||||||
|
|
Loading…
Add table
Reference in a new issue