Skip to content
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
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ url = { version = "2.1.1", features = ["serde"] }
walkdir = "2"
zip = { version = "7.0.0", default-features = false, features = ["bzip2"] }

[workspace.lints.clippy]
dbg_macro = "warn"
todo = "warn"

[profile.dev]
# recommendation coming from
# https://doc.rust-lang.org/nightly/cargo/guide/build-performance.html#reduce-amount-of-generated-debug-information
Expand Down
3 changes: 3 additions & 0 deletions crates/bin/cratesfyi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ docs_rs_watcher = { path = "../docs_rs_watcher" }
docs_rs_web = { path = "../docs_rs_web" }
tokio = { workspace = true }
tracing = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/bin/docs_rs_admin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ docs_rs_test_fakes = { path = "../../lib/docs_rs_test_fakes" }
docs_rs_types = { path = "../../lib/docs_rs_types", features = ["testing"] }
pretty_assertions = { workspace = true }
test-case = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/bin/docs_rs_builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ docs_rs_types = { path = "../../lib/docs_rs_types", features = ["testing"] }
docs_rs_utils = { path = "../../lib/docs_rs_utils", features = ["testing"] }
pretty_assertions = { workspace = true }
test-case = { workspace = true }

[lints]
workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,6 @@ mod tests {
.collect();
json_files.retain(|f| f.ends_with(&format!(".json.{ext}")));
json_files.sort();
dbg!(&json_files);
assert!(json_files[0].starts_with(&format!("empty-library_1.0.0_{target}_")));
assert!(json_files[0].ends_with(&format!(".json.{ext}")));
assert_eq!(
Expand Down
3 changes: 3 additions & 0 deletions crates/bin/docs_rs_import_release/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ tokio = { workspace = true }
tracing = { workspace = true }
walkdir = { workspace = true }
zip = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/bin/docs_rs_watcher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ docs_rs_test_fakes = { path = "../../lib/docs_rs_test_fakes" }
docs_rs_types = { path = "../../lib/docs_rs_types", features = ["testing"] }
pretty_assertions = { workspace = true }
test-case = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/bin/docs_rs_web/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,6 @@ pretty_assertions = { workspace = true }
tempfile = { workspace = true }
test-case = { workspace = true }
walkdir = { workspace = true }

[lints]
workspace = true
39 changes: 10 additions & 29 deletions crates/bin/docs_rs_web/src/extractors/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1369,14 +1369,11 @@ mod tests {
.with_target_name("dummy")
.with_doc_targets(TARGETS.iter().cloned());

dbg!(&params);

assert!(params.doc_target().is_none());
assert_eq!(params.inner_path(), "dummy/struct.Dummy.html");
assert_eq!(params.storage_path(), "dummy/struct.Dummy.html");

let params = params.with_doc_target(DEFAULT_TARGET);
dbg!(&params);
assert_eq!(params.doc_target(), Some(DEFAULT_TARGET));
assert_eq!(params.inner_path(), "dummy/struct.Dummy.html");
assert_eq!(params.storage_path(), "dummy/struct.Dummy.html");
Expand Down Expand Up @@ -1439,8 +1436,6 @@ mod tests {
.with_maybe_inner_path(path)
.with_doc_targets(TARGETS.iter().cloned());

dbg!(&params);

assert_eq!(params.doc_target(), expected_target);
assert_eq!(params.inner_path(), expected_path);
}
Expand Down Expand Up @@ -1587,7 +1582,6 @@ mod tests {

// with page-kind "Rustdoc", we get the full path with static suffix
let params = params.with_page_kind(PageKind::Rustdoc);
dbg!(&params);
assert_eq!(
params.rustdoc_url(),
format!("/krate/latest/{OTHER_TARGET}/path_add/static.html")
Expand Down Expand Up @@ -1632,8 +1626,6 @@ mod tests {
.with_doc_target("dummy")
.with_inner_path("struct.Dummy.html");

dbg!(&params);

// initial params, doc-target is "dummy", not validated
assert_eq!(params.doc_target(), Some("dummy"));
assert_eq!(params.inner_path(), "struct.Dummy.html");
Expand All @@ -1645,8 +1637,6 @@ mod tests {
.with_target_name(KRATE.to_string())
.with_doc_targets(TARGETS.iter().cloned());

dbg!(&params);

assert_eq!(params.doc_target(), None);
assert_eq!(params.inner_path(), "dummy/struct.Dummy.html");

Expand All @@ -1655,7 +1645,6 @@ mod tests {
// Then we expect the path to be intact still, and the target to be set, even
// though the folder-part of the path was initially generated from the doc_target field.
let params = params.with_doc_target(OTHER_TARGET);
dbg!(&params);
assert_eq!(params.doc_target(), Some(OTHER_TARGET));
assert_eq!(params.inner_path(), "dummy/struct.Dummy.html");
}
Expand Down Expand Up @@ -1703,23 +1692,19 @@ mod tests {
#[test]
fn test_parse_something() {
// test for https://github.com/rust-lang/docs.rs/issues/2989
let params = dbg!(
RustdocParams::new(KRATE)
.with_page_kind(PageKind::Rustdoc)
.try_with_original_uri(format!("/{KRATE}/latest/{KRATE}"))
.unwrap()
.with_req_version(ReqVersion::Latest)
.with_doc_target(KRATE.to_string())
);
let params = RustdocParams::new(KRATE)
.with_page_kind(PageKind::Rustdoc)
.try_with_original_uri(format!("/{KRATE}/latest/{KRATE}"))
.unwrap()
.with_req_version(ReqVersion::Latest)
.with_doc_target(KRATE.to_string());

assert_eq!(params.rustdoc_url(), "/krate/latest/krate/");

let params = dbg!(
params
.with_target_name(KRATE.to_string())
.with_default_target(DEFAULT_TARGET)
.with_doc_targets(TARGETS.iter().cloned())
);
let params = params
.with_target_name(KRATE.to_string())
.with_default_target(DEFAULT_TARGET)
.with_doc_targets(TARGETS.iter().cloned());

assert_eq!(params.rustdoc_url(), "/krate/latest/krate/");
}
Expand All @@ -1742,8 +1727,6 @@ mod tests {
.with_target_name(KRATE.to_string())
.with_doc_targets(TARGETS.iter().cloned());

dbg!(&params);

assert_eq!(params.rustdoc_url(), expected_url);
}

Expand All @@ -1761,8 +1744,6 @@ mod tests {
.with_doc_target(KRATE.to_string())
.with_inner_path("trait.Itertools.html");

dbg!(&params);

assert_eq!(
params.rustdoc_url(),
format!("/{KRATE}/0.14.0/{KRATE}/trait.Itertools.html")
Expand Down
6 changes: 3 additions & 3 deletions crates/bin/docs_rs_web/src/handlers/builds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,14 +550,14 @@ mod tests {
};
Overrides::save(&mut conn, &FOO, limits).await?;

let page = kuchikiki::parse_html().one(dbg!(
let page = kuchikiki::parse_html().one(
env.web_app()
.await
.assert_success(&format!("/crate/foo/{V1}/builds"))
.await?
.text()
.await?
));
.await?,
);

let header = page.select(".about h4").unwrap().next().unwrap();
assert_eq!(header.text_contents(), "foo's sandbox limits");
Expand Down
21 changes: 5 additions & 16 deletions crates/bin/docs_rs_web/src/handlers/crate_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1812,8 +1812,6 @@ mod tests {
})
.collect();

dbg!(&platform_links);

assert_eq!(platform_links.len(), 2);

for (_, url, rel) in &platform_links {
Expand All @@ -1836,7 +1834,7 @@ mod tests {
url: &str,
should_contain_redirect: bool,
) {
let response = env.web_app().await.get(dbg!(url)).await.unwrap();
let response = env.web_app().await.get(url).await.unwrap();
let status = response.status();
assert!(
status.is_success(),
Expand All @@ -1846,11 +1844,7 @@ mod tests {
response.redirect_target().unwrap_or_default(),
);
let text = response.text().await.unwrap();
let list1 = dbg!(check_links(
text.clone(),
false,
dbg!(should_contain_redirect)
));
let list1 = check_links(text.clone(), false, should_contain_redirect);

// Same test with AJAX endpoint.
let platform_menu_url = kuchikiki::parse_html()
Expand All @@ -1862,12 +1856,7 @@ mod tests {
.get("data-url")
.expect("data-url")
.to_string();
let response = env
.web_app()
.await
.get(&dbg!(platform_menu_url))
.await
.unwrap();
let response = env.web_app().await.get(&platform_menu_url).await.unwrap();
assert!(
response.status().is_success(),
"{}",
Expand All @@ -1877,11 +1866,11 @@ mod tests {
CachePolicy::ForeverInCdn(KrateName::from_str("dummy").unwrap().into()),
env.config(),
);
let list2 = dbg!(check_links(
let list2 = check_links(
response.text().await.unwrap(),
true,
should_contain_redirect,
));
);
assert_eq!(list1, list2);
}

Expand Down
13 changes: 4 additions & 9 deletions crates/bin/docs_rs_web/src/handlers/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,6 @@ pub(crate) async fn rustdoc_redirector_handler(
Ok(axum_cached_redirect(url, cache_policy)?)
}

dbg!(&params);
dbg!(&original_uri);

// edge case 1:
// global static assets for older builds are served from the root, which ends up
// in this handler as `params.name`.
Expand Down Expand Up @@ -359,8 +356,6 @@ pub(crate) async fn rustdoc_redirector_handler(
.await;
}

dbg!(&params);

if matched_release.rustdoc_status() {
Ok(redirect_to_doc(
&original_uri,
Expand Down Expand Up @@ -1871,7 +1866,7 @@ mod test {
) -> Result<(), anyhow::Error> {
let mut links: BTreeMap<_, _> = links.iter().copied().collect();

for (platform, link, rel) in dbg!(get_platform_links(path, web).await?) {
for (platform, link, rel) in get_platform_links(path, web).await? {
assert_eq!(rel, "nofollow");
web.assert_redirect(&link, links.remove(platform.as_str()).unwrap())
.await?;
Expand Down Expand Up @@ -2887,15 +2882,15 @@ mod test {
.create()
.await?;

let dom = kuchikiki::parse_html().one(dbg!(
let dom = kuchikiki::parse_html().one(
env.web_app()
.await
.get("/testing/0.1.0/testing/")
.await?
.error_for_status()?
.text()
.await?
));
.await?,
);
assert!(
dom.select(
r#"a[href="/optional-dep/^1.2.3/"] > i[class="dependencies normal"] + i"#
Expand Down
6 changes: 1 addition & 5 deletions crates/bin/docs_rs_web/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,12 @@ mod tests {
*entry += 2;
}

let collected = dbg!(env.collected_metrics());
let collected = env.collected_metrics();
let metric = collected.get_metric("web", "docsrs.web.routes_visited")?;
let AggregatedMetrics::U64(MetricData::Sum(routes_visited)) = metric.data() else {
panic!("Expected Sum<U64> metric data");
};

dbg!(&routes_visited);

let routes_visited: HashMap<String, u64> = routes_visited
.data_points()
.map(|dp| {
Expand Down Expand Up @@ -245,8 +243,6 @@ mod tests {
panic!("Expected Histogram<F64> metric data");
};

dbg!(&response_time);

let response_time_sample_counts: HashMap<String, u64> = response_time
.data_points()
.map(|dp| {
Expand Down
3 changes: 3 additions & 0 deletions crates/lib/crates_io_validation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ edition = "2024"
[dependencies]
thiserror = "=2.0.18"
unicode-xid = "=0.2.6"

[lints]
workspace = true
2 changes: 2 additions & 0 deletions crates/lib/docs_rs_build_limits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ docs_rs_types = { path = "../docs_rs_types", features = ["testing"] }
pretty_assertions = { workspace = true }
tokio = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/lib/docs_rs_build_queue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ docs_rs_types = { path = "../docs_rs_types", features = ["testing"] }
docs_rs_utils = { path = "../../lib/docs_rs_utils", features = ["testing"] }
pretty_assertions = { workspace = true }
test-case = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/lib/docs_rs_cargo_metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ serde_json = { workspace = true }

[dev-dependencies]
test-case = { workspace = true }

[lints]
workspace = true
2 changes: 2 additions & 0 deletions crates/lib/docs_rs_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ testing = []
[dependencies]
anyhow = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/lib/docs_rs_context/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ docs_rs_repository_stats = { path = "../docs_rs_repository_stats" }
docs_rs_storage = { path = "../docs_rs_storage" }
docs_rs_test_fakes = { path = "../docs_rs_test_fakes", optional = true }
tokio = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/lib/docs_rs_database/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ docs_rs_types = { path = "../docs_rs_types", features = ["testing"] }
rand = { workspace = true }
tempfile = { workspace = true }
test-case = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/lib/docs_rs_env_vars/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ edition.workspace = true
[dependencies]
anyhow = { workspace = true }
tracing = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/lib/docs_rs_fastly/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ docs_rs_headers = { path = "../docs_rs_headers", features = ["testing"] }
docs_rs_opentelemetry = { path = "../docs_rs_opentelemetry", features = ["testing"] }
mockito = { workspace = true }
tokio = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/lib/docs_rs_headers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ axum-extra = { workspace = true }
serde_json = { workspace = true }
test-case = { workspace = true }
tokio = { workspace = true }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions crates/lib/docs_rs_logging/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ tracing-subscriber = { version = "0.3.20", default-features = false, features =

[dev-dependencies]
docs_rs_config = { path = "../docs_rs_config", features = ["testing"] }

[lints]
workspace = true
Loading
Loading