Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy and docs fixups #6

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static METADATA_FILE: &str = "METADATA.pb";
pub struct RepoInfo {
/// The name of the repository.
///
/// This is everything after the trailing '/' in e.g. "https://github.com/PaoloBiagini/Joan"
/// This is everything after the trailing '/' in e.g. `https://github.com/PaoloBiagini/Joan`
pub repo_name: String,
/// The repository's url
pub repo_url: String,
Expand Down Expand Up @@ -81,7 +81,7 @@ pub fn discover_sources(
have_repo.len()
);
let has_config_files = if let Some(font_path) = sources_dir {
find_config_files(&have_repo, &font_path)
find_config_files(&have_repo, font_path)
} else {
let tempdir = tempfile::tempdir().unwrap();
find_config_files(&have_repo, tempdir.path())
Expand Down Expand Up @@ -278,7 +278,7 @@ enum ConfigFetchIssue {
BadRepoUrl(String),
// contains stderr
GitFail(String),
Http(ureq::Error),
Http(Box<ureq::Error>),
}

/// Checks for a config file in a given repo.
Expand All @@ -294,7 +294,9 @@ fn config_files_for_repo(
// - otherwise try naive http requests first,
// - and then finally clone the repo and look
let local_git_dir = local_repo_dir.join(".git");
if local_git_dir.exists() {}
if local_git_dir.exists() {
return get_config_paths(&local_repo_dir).ok_or(ConfigFetchIssue::NoConfigFound);
}

let naive = config_file_from_remote_naive(repo_url).map(|p| vec![p]);
// if not found, try checking out and looking; otherwise return the result
Expand Down Expand Up @@ -326,7 +328,7 @@ fn config_file_from_remote_naive(repo_url: &str) -> Result<PathBuf, ConfigFetchI
return Err(ConfigFetchIssue::RateLimit(backoff));
}
Err(e) => {
return Err(ConfigFetchIssue::Http(e));
return Err(ConfigFetchIssue::Http(Box::new(e)));
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl FromStr for Metadata {
///
/// This is expected to be temporary (until the official protobufs crate is done? and isn't
/// fully spec compliant, e.g. doesn't handle escape sequences)
#[allow(clippy::skip_while_next)] // we use skip_while so we can track if last byte was `\`
fn extract_litstr(s: &str) -> Option<&str> {
let s = s.trim();
if s.bytes().next() != Some(b'"') {
Expand Down
Loading