From 69062c4c3947e4654ce797f61417f6f9fbac93c8 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Thu, 23 May 2024 11:13:38 -0400 Subject: [PATCH] Cleanup --- src/main.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index ad47086..44b01a9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ #![feature(try_blocks)] -#![feature(absolute_path)] use anyhow::bail; use anyhow::Context; use anyhow::Result; @@ -172,8 +171,7 @@ async fn build_docs() -> Result { let root_path = output_path .parent() - .map(|p| p.parent()) - .flatten() + .and_then(|p| p.parent()) .context("Crate docs directory is invalid")?; if !root_path.is_dir() { @@ -210,9 +208,17 @@ struct LocalDocsPath { #[serde(tag = "reason")] #[serde(rename_all = "kebab-case")] enum CargoDocLine { - CompilerArtifact { filenames: Vec }, - BuildFinished { success: bool }, + CompilerArtifact { + filenames: Vec, + }, + BuildFinished { + success: bool, + }, + // This is dead code, but serde won't deserialize if I use `()`, since it expects a map + // I could probably tell serde to deserialize the insides as a map, but it doesn't matter + #[allow(dead_code)] BuildScriptExecuted(Value), + #[allow(dead_code)] CompilerMessage(Value), } @@ -228,8 +234,7 @@ async fn get_std_docs_path() -> Result { )); let path = path .parent() - .map(|p| p.parent()) - .flatten() + .and_then(|p| p.parent()) .context("std docs directory is invalid")?; if !path.is_dir() {