Skip to content

Commit fb79fcc

Browse files
committed
lint
1 parent 0745b93 commit fb79fcc

File tree

6 files changed

+35
-25
lines changed

6 files changed

+35
-25
lines changed

api/build.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,14 @@ use std::path::Path;
55
fn main() {
66
let static_dir = Path::new("../frontend/static/ddoc");
77
fs::create_dir_all(static_dir).unwrap();
8-
9-
fs::write(
10-
static_dir.join("style.css"),
11-
deno_doc::html::STYLESHEET,
12-
).unwrap();
13-
8+
9+
fs::write(static_dir.join("style.css"), deno_doc::html::STYLESHEET).unwrap();
10+
1411
fs::write(
1512
static_dir.join("comrak.css"),
1613
deno_doc::html::comrak::COMRAK_STYLESHEET,
17-
).unwrap();
18-
19-
fs::write(
20-
static_dir.join("script.js"),
21-
deno_doc::html::SCRIPT_JS,
22-
).unwrap();
23-
}
14+
)
15+
.unwrap();
16+
17+
fs::write(static_dir.join("script.js"), deno_doc::html::SCRIPT_JS).unwrap();
18+
}

api/src/analysis.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,20 @@ async fn analyze_package_inner(
276276
.map(std::borrow::Cow::Borrowed);
277277
let partitions =
278278
deno_doc::html::partition::partition_nodes_by_name(&ctx, doc_nodes, true);
279-
let render_ctx = deno_doc::html::RenderContext::new(&ctx, &[], deno_doc::html::UrlResolveKind::AllSymbols);
279+
let render_ctx = deno_doc::html::RenderContext::new(
280+
&ctx,
281+
&[],
282+
deno_doc::html::UrlResolveKind::AllSymbols,
283+
);
280284

281285
let mut doc_search = partitions
282286
.into_iter()
283287
.flat_map(|(name, nodes)| {
284288
deno_doc::html::search::doc_nodes_into_search_index_node(
285-
&render_ctx, nodes, name, None,
289+
&render_ctx,
290+
nodes,
291+
name,
292+
None,
286293
)
287294
})
288295
.collect::<Vec<_>>();

api/src/api/package.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,12 +846,12 @@ pub async fn version_publish_handler(
846846
hash_.lock().unwrap().as_mut().unwrap().update(&bytes);
847847
total_size_.fetch_add(bytes.len() as u64, Ordering::SeqCst);
848848
if total_size_.load(Ordering::SeqCst) > MAX_PUBLISH_TARBALL_SIZE {
849-
Err(io::Error::new(io::ErrorKind::Other, "Payload too large"))
849+
Err(io::Error::other("Payload too large"))
850850
} else {
851851
Ok(bytes)
852852
}
853853
}
854-
Err(err) => Err(io::Error::new(io::ErrorKind::Other, err)),
854+
Err(err) => Err(io::Error::other(err)),
855855
});
856856

857857
let upload_result = buckets
@@ -1947,6 +1947,7 @@ lazy_static::lazy_static! {
19471947

19481948
// We have to spawn another tokio runtime, because
19491949
// `deno_graph::ModuleGraph::build` is not thread-safe.
1950+
#[allow(clippy::result_large_err)]
19501951
#[tokio::main(flavor = "current_thread")]
19511952
async fn analyze_deps_tree(
19521953
registry_url: Url,

api/src/docs.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -577,14 +577,18 @@ pub fn generate_docs_html(
577577
(
578578
render_ctx.clone(),
579579
{
580-
let mut header = deno_doc::html::SectionHeaderCtx::new_for_all_symbols(
581-
&render_ctx,
582-
&path,
583-
);
580+
let mut header =
581+
deno_doc::html::SectionHeaderCtx::new_for_all_symbols(
582+
&render_ctx,
583+
&path,
584+
);
584585

585586
if let Some(header) = &mut header {
586-
if let Some(all_symbols_section_prefix) = &all_symbols_section_prefix {
587-
header.title = format!("{all_symbols_section_prefix}{}", header.title);
587+
if let Some(all_symbols_section_prefix) =
588+
&all_symbols_section_prefix
589+
{
590+
header.title =
591+
format!("{all_symbols_section_prefix}{}", header.title);
588592
}
589593
}
590594

api/src/npm/specifiers.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ pub fn relative_import_specifier(
9191
) -> String {
9292
let relative = base_specifier.make_relative(specifier).unwrap();
9393
if relative.is_empty() {
94-
format!("./{}", specifier.path_segments().unwrap().last().unwrap())
94+
format!(
95+
"./{}",
96+
specifier.path_segments().unwrap().next_back().unwrap()
97+
)
9598
} else if relative.starts_with("../") {
9699
relative.to_string()
97100
} else {

api/src/tarball.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub async fn process_tarball(
9898
.await
9999
.map_err(PublishError::GcsDownloadError)?
100100
.ok_or(PublishError::MissingTarball)?
101-
.map_err(|e| io::Error::new(io::ErrorKind::Other, e));
101+
.map_err(io::Error::other);
102102

103103
let async_read = stream.into_async_read();
104104
let mut tar = async_tar::Archive::new(async_read)

0 commit comments

Comments
 (0)