summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKornel <kornel@geekhood.net>2020-03-03 19:23:12 +0000
committerKornel <kornel@geekhood.net>2020-03-10 00:43:09 +0000
commit68044807289ac950b94fa0d02c58d7531b127863 (patch)
treef5731ec3a5a4d2622a0cc5f8e4a082229ca35104
parent9e72f373a1042bfe3a8510d004b83a2af394772a (diff)
Clippy
-rw-r--r--deps_index/src/deps_stats.rs2
-rw-r--r--feat_extractor/src/lib.rs2
-rw-r--r--kitchen_sink/src/lib_kitchen_sink.rs2
-rw-r--r--reindex/src/bin/reindex_crates.rs4
-rw-r--r--rich_crate/src/lib.rs2
5 files changed, 9 insertions, 3 deletions
diff --git a/deps_index/src/deps_stats.rs b/deps_index/src/deps_stats.rs
index 5d2bc24..e8ebfec 100644
--- a/deps_index/src/deps_stats.rs
+++ b/deps_index/src/deps_stats.rs
@@ -149,6 +149,7 @@ impl Index {
converted.extend(collected.into_iter().map(|(k, v)| {
let name = inter.resolve(k).expect("resolve");
debug_assert_eq!(name, name.to_ascii_lowercase());
+ debug_assert!(!name.is_empty());
(name.into(), v)
}));
Ok(converted)
@@ -177,6 +178,7 @@ impl Index {
let t = n.versions.entry(semver).or_insert(0);
*t = t.checked_add(1).expect("overflow");
if depinf.direct {
+ debug_assert!(!parent_name.is_empty());
n.rev_dep_names.push(&parent_name);
}
match depinf.ty {
diff --git a/feat_extractor/src/lib.rs b/feat_extractor/src/lib.rs
index 1cd8150..94769f5 100644
--- a/feat_extractor/src/lib.rs
+++ b/feat_extractor/src/lib.rs
@@ -70,7 +70,7 @@ pub fn auto_keywords(manifest: &Manifest, github_description: Option<&str>, read
let d = extract_text_phrases(manifest, github_description, readme_text);
let mut sw = rake::StopWords::new();
sw.reserve(STOPWORDS.len());
- sw.extend(STOPWORDS.iter().map(|s| s.to_string())); // TODO: use real stopwords, THEN filter via STOPWORDS again, because multiple Rust-y words are fine
+ sw.extend(STOPWORDS.iter().map(|s| (*s).to_string())); // TODO: use real stopwords, THEN filter via STOPWORDS again, because multiple Rust-y words are fine
// normalize space and _ to -
let r = rake::Rake::new(sw);
let rake_keywords = r.run_sentences(d.iter().map(|(_, s)| s.as_str()));
diff --git a/kitchen_sink/src/lib_kitchen_sink.rs b/kitchen_sink/src/lib_kitchen_sink.rs
index 0498091..b798bff 100644
--- a/kitchen_sink/src/lib_kitchen_sink.rs
+++ b/kitchen_sink/src/lib_kitchen_sink.rs
@@ -1868,6 +1868,7 @@ impl KitchenSink {
Err(KitchenSinkErr::OwnerWithoutLogin)?
}
+ #[inline]
pub async fn crates_of_author(&self, aut: &RichAuthor) -> CResult<Vec<CrateOwnerRow>> {
self.crate_db.crates_of_author(aut.github.id).await
}
@@ -2081,6 +2082,7 @@ impl KitchenSink {
self.crates_io.cleanup();
}
+ #[inline]
pub async fn author_by_login(&self, login: &str) -> CResult<RichAuthor> {
let github = self.gh.user_by_login(login).await?.ok_or_else(|| KitchenSinkErr::AuthorNotFound(login.to_owned()))?;
Ok(RichAuthor {
diff --git a/reindex/src/bin/reindex_crates.rs b/reindex/src/bin/reindex_crates.rs
index bae95bd..73d71a8 100644
--- a/reindex/src/bin/reindex_crates.rs
+++ b/reindex/src/bin/reindex_crates.rs
@@ -259,7 +259,9 @@ async fn crate_overall_score(crates: &KitchenSink, all: &RichCrate, k: &RichCrat
temp_inp.number_of_indirect_reverse_deps = deps.runtime.def.max(deps.build.def).into();
temp_inp.number_of_indirect_reverse_optional_deps = indirect_reverse_optional_deps;
let tmp = futures::future::join_all(deps.rev_dep_names.iter()
- .map(|name| async move { crates.downloads_per_month(&Origin::from_crates_io_name(name)).await })).await;
+ .map(|name| async move {
+ crates.downloads_per_month(&Origin::from_crates_io_name(name)).await
+ })).await;
let biggest = tmp.into_iter().filter_map(|x| x.ok().and_then(|x| x)).max().unwrap_or(0);
temp_inp.downloads_per_month_minus_most_downloaded_user = downloads_per_month.saturating_sub(biggest as u32);
}
diff --git a/rich_crate/src/lib.rs b/rich_crate/src/lib.rs
index a1dc124..1b19abf 100644
--- a/rich_crate/src/lib.rs
+++ b/rich_crate/src/lib.rs
@@ -34,7 +34,7 @@ impl fmt::Debug for Origin {
impl Origin {
pub fn from_crates_io_name(name: &str) -> Self {
- assert!(!name.is_empty() && is_alnum(name), "bad crate name: {}", name);
+ assert!(!name.is_empty() && is_alnum(name), "bad crate name: '{}'", name);
Origin::CratesIo(name.to_ascii_lowercase().into())
}