Skip to content

Commit 43db0dc

Browse files
committed
remove future::join! inside get_number_of_tags_branches + exclude non async func from future::join! #269
1 parent 69e6452 commit 43db0dc

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

src/onefetch/info.rs

+11-15
Original file line numberDiff line numberDiff line change
@@ -315,33 +315,29 @@ impl Info {
315315
Language::get_language_stats(workdir_str, &config.excluded)?;
316316

317317
let (
318-
(repository_name, repository_url),
319318
git_history,
320319
(number_of_tags, number_of_branches),
321-
current_commit_info,
322320
(git_v, git_user),
323321
version,
324322
pending,
325323
repo_size,
326-
project_license,
327-
dominant_language,
328324
) = futures::join!(
329-
Info::get_repo_name_and_url(&repo),
330325
Info::get_git_history(workdir_str, config.no_merges),
331326
Info::get_number_of_tags_branches(workdir_str),
332-
Info::get_current_commit_info(&repo),
333327
Info::get_git_version_and_username(workdir_str),
334328
Info::get_version(workdir_str),
335329
Info::get_pending_changes(workdir_str),
336-
Info::get_packed_size(workdir_str),
337-
Info::get_project_license(workdir_str),
338-
Language::get_dominant_language(&languages_stats)
330+
Info::get_packed_size(workdir_str)
339331
);
340332

333+
let (repository_name, repository_url) = Info::get_repo_name_and_url(&repo);
334+
let current_commit_info = Info::get_current_commit_info(&repo);
341335
let creation_date = Info::get_creation_date(&git_history);
342336
let number_of_commits = Info::get_number_of_commits(&git_history);
343337
let authors = Info::get_authors(&git_history, config.number_of_authors);
344338
let last_change = Info::get_date_of_last_commit(&git_history);
339+
let project_license = Info::get_project_license(workdir_str);
340+
let dominant_language = Language::get_dominant_language(&languages_stats);
345341

346342
Ok(Info {
347343
git_version: git_v,
@@ -385,7 +381,7 @@ impl Info {
385381
}
386382

387383
async fn get_number_of_tags_branches(dir: &str) -> (usize, usize) {
388-
let tags = async {
384+
let tags = {
389385
let output = Command::new("git")
390386
.args(vec!["-C", dir, "tag"])
391387
.output()
@@ -397,7 +393,7 @@ impl Info {
397393
tags.lines().count()
398394
};
399395

400-
let branches = async {
396+
let branches = {
401397
let output = Command::new("git")
402398
.args(vec!["-C", dir, "branch", "-r"])
403399
.output()
@@ -413,10 +409,10 @@ impl Info {
413409
}
414410
};
415411

416-
futures::join!(tags, branches)
412+
(tags, branches)
417413
}
418414

419-
async fn get_repo_name_and_url(repo: &Repository) -> (String, String) {
415+
fn get_repo_name_and_url(repo: &Repository) -> (String, String) {
420416
let config = repo
421417
.config()
422418
.chain_err(|| "Could not retrieve git configuration data");
@@ -451,7 +447,7 @@ impl Info {
451447
(repository_name, remote_url)
452448
}
453449

454-
async fn get_current_commit_info(repo: &Repository) -> Result<CommitInfo> {
450+
fn get_current_commit_info(repo: &Repository) -> Result<CommitInfo> {
455451
let head = repo
456452
.head()
457453
.chain_err(|| "Error while retrieving reference information")?;
@@ -683,7 +679,7 @@ impl Info {
683679
Ok(output)
684680
}
685681

686-
async fn get_project_license(dir: &str) -> Result<String> {
682+
fn get_project_license(dir: &str) -> Result<String> {
687683
fn is_license_file<S: AsRef<str>>(file_name: S) -> bool {
688684
LICENSE_FILES
689685
.iter()

src/onefetch/language.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl Language {
208208
Ok((stat_vec, loc))
209209
}
210210

211-
pub async fn get_dominant_language(languages_stat_vec: &[(Language, f64)]) -> Language {
211+
pub fn get_dominant_language(languages_stat_vec: &[(Language, f64)]) -> Language {
212212
languages_stat_vec[0].0.clone()
213213
}
214214
}

0 commit comments

Comments
 (0)