From 25697fb672865b21cb3785f702383d7ea7ca7664 Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Sun, 16 Nov 2025 19:58:09 -0300 Subject: [PATCH 1/2] Upgrade to Rust 2024 edition --- Cargo.toml | 2 +- src/cli/cmd/add/mod.rs | 14 ++++----- src/cli/cmd/convert.rs | 64 +++++++++++++++++++++------------------- src/cli/cmd/eject/mod.rs | 9 +++--- src/cli/cmd/login/mod.rs | 8 ++--- src/cli/cmd/mod.rs | 35 +++++++++++----------- 6 files changed, 67 insertions(+), 65 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b2ac2f7..5fbc7fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "fh" version = "0.1.27" authors = ["Determinate Systems "] -edition = "2021" +edition = "2024" license = "Apache 2.0" repository = "https://github.com/DeterminateSystems/fh" diff --git a/src/cli/cmd/add/mod.rs b/src/cli/cmd/add/mod.rs index 177ca5b..4773231 100644 --- a/src/cli/cmd/add/mod.rs +++ b/src/cli/cmd/add/mod.rs @@ -100,11 +100,11 @@ pub(crate) async fn load_flake( let mut parsed = nixel::parse(contents.clone()); - if let nixel::Expression::Map(map) = *parsed.expression.clone() { - if map.bindings.is_empty() { - contents = FALLBACK_FLAKE_CONTENTS.to_string(); - parsed = nixel::parse(FALLBACK_FLAKE_CONTENTS.to_string()); - } + if let nixel::Expression::Map(map) = *parsed.expression.clone() + && map.bindings.is_empty() + { + contents = FALLBACK_FLAKE_CONTENTS.to_string(); + parsed = nixel::parse(FALLBACK_FLAKE_CONTENTS.to_string()); } Ok((contents, parsed)) @@ -130,9 +130,9 @@ async fn infer_flake_input_name_url( match (input_name, path_parts.next()) { (Some(input_name), _) => Ok((input_name, parsed_url)), (None, Some(input_name)) => Ok((input_name.to_string(), parsed_url)), - (None, _) => Err(color_eyre::eyre::eyre!( + (None, _) => Err(color_eyre::eyre::eyre!( "cannot infer an input name for {parsed_url}; please specify one with the `--input-name` flag" - )) + )), } } // A URL like `nixos/nixpkgs` or `nixos/nixpkgs/0.2411` diff --git a/src/cli/cmd/convert.rs b/src/cli/cmd/convert.rs index 1dfa0f7..0797e89 100644 --- a/src/cli/cmd/convert.rs +++ b/src/cli/cmd/convert.rs @@ -5,9 +5,9 @@ use std::process::{ExitCode, Stdio}; use clap::Parser; use color_eyre::eyre::Context; use once_cell::sync::Lazy; -use tracing::{span, Level}; +use tracing::{Level, span}; -use super::{nix_command, CommandExecute}; +use super::{CommandExecute, nix_command}; // match {nixos,nixpkgs,release}-YY.MM branches static RELEASE_BRANCH_REGEX: Lazy = Lazy::new(|| { @@ -214,34 +214,34 @@ impl ConvertSubcommand { } // - has no nixpkgs in inputs but does have it in flake.lock, add it to flakehub.com/f/nixos/nixpkgs/0.1.0.tar.gz - if let Some(outputs_attr) = outputs_attr { - if let nixel::Expression::Function(f) = &*outputs_attr.to { - match &f.head { - // outputs = { nixpkgs, ... } @ inputs: { } - nixel::FunctionHead::Destructured(head) - if head - .arguments - .iter() - .any(|arg| *arg.identifier == input_name) => - { - let (_, flakehub_url) = crate::cli::cmd::add::get_flakehub_project_and_url( - &self.api_addr, - "nixos", - &input_name, - None, - ) - .await?; - - new_flake_contents = crate::cli::cmd::add::flake::insert_flake_input( - expr, - input_name.clone(), - flakehub_url.clone(), - new_flake_contents, - crate::cli::cmd::add::flake::InputsInsertionLocation::Top, - )?; - } - _ => {} + if let Some(outputs_attr) = outputs_attr + && let nixel::Expression::Function(f) = &*outputs_attr.to + { + match &f.head { + // outputs = { nixpkgs, ... } @ inputs: { } + nixel::FunctionHead::Destructured(head) + if head + .arguments + .iter() + .any(|arg| *arg.identifier == input_name) => + { + let (_, flakehub_url) = crate::cli::cmd::add::get_flakehub_project_and_url( + &self.api_addr, + "nixos", + &input_name, + None, + ) + .await?; + + new_flake_contents = crate::cli::cmd::add::flake::insert_flake_input( + expr, + input_name.clone(), + flakehub_url.clone(), + new_flake_contents, + crate::cli::cmd::add::flake::InputsInsertionLocation::Top, + )?; } + _ => {} } } @@ -806,8 +806,10 @@ mod test { .await .unwrap(); - assert!(new_flake_contents - .contains(r#"nixpkgs.url = "http://flakehub-localhost/f/NixOS/nixpkgs/*.tar.gz";"#)); + assert!( + new_flake_contents + .contains(r#"nixpkgs.url = "http://flakehub-localhost/f/NixOS/nixpkgs/*.tar.gz";"#) + ); } #[tokio::test] diff --git a/src/cli/cmd/eject/mod.rs b/src/cli/cmd/eject/mod.rs index fb9f5fc..88d0935 100644 --- a/src/cli/cmd/eject/mod.rs +++ b/src/cli/cmd/eject/mod.rs @@ -4,7 +4,7 @@ use std::process::ExitCode; use clap::Parser; use once_cell::sync::Lazy; -use tracing::{span, Level}; +use tracing::{Level, span}; use super::{CommandExecute, FlakeHubClient, ProjectMetadata}; @@ -220,7 +220,8 @@ async fn eject_flakehub_input_to_github( fn separate_year_from_month_in_version(version: &str) -> Option { let release_version_captures = RELEASE_VERSION_REGEX.captures(version); - let version = match release_version_captures { + + match release_version_captures { Some(captures) => { let year = captures.name("year").unwrap().as_str(); let month = captures.name("month").unwrap().as_str(); @@ -228,9 +229,7 @@ fn separate_year_from_month_in_version(version: &str) -> Option { Some(format!("{year}.{month}")) } _ => None, - }; - - version + } } #[cfg(test)] diff --git a/src/cli/cmd/login/mod.rs b/src/cli/cmd/login/mod.rs index 2c3441b..a7d380e 100644 --- a/src/cli/cmd/login/mod.rs +++ b/src/cli/cmd/login/mod.rs @@ -376,10 +376,10 @@ pub(crate) async fn user_auth_token_read_path() -> Result { let write_path = user_auth_token_write_path(); // If the user's personal token file exists, we use that first. - if let Ok(ref path) = write_path { - if tokio::fs::metadata(&path).await.is_ok() { - return Ok(path.to_path_buf()); - } + if let Ok(ref path) = write_path + && tokio::fs::metadata(&path).await.is_ok() + { + return Ok(path.to_path_buf()); } // Either XDG failed to give us a path, or the user's token doesn't exist, so fall back diff --git a/src/cli/cmd/mod.rs b/src/cli/cmd/mod.rs index 2721e06..f8e0f7e 100644 --- a/src/cli/cmd/mod.rs +++ b/src/cli/cmd/mod.rs @@ -16,13 +16,13 @@ use std::{fmt::Display, process::Stdio}; use color_eyre::eyre::{self, WrapErr}; use once_cell::sync::Lazy; use reqwest::{ - header::{HeaderMap, HeaderValue, ACCEPT, AUTHORIZATION}, Client, StatusCode, + header::{ACCEPT, AUTHORIZATION, HeaderMap, HeaderValue}, }; use serde::{Deserialize, Serialize}; use tabled::settings::{ - style::{HorizontalLine, On, VerticalLineIter}, Style, + style::{HorizontalLine, On, VerticalLineIter}, }; use tokio::process::Command; use url::Url; @@ -34,7 +34,7 @@ use self::{ search::SearchResult, status::TokenStatus, }; -use crate::{flakehub_url, APP_USER_AGENT}; +use crate::{APP_USER_AGENT, flakehub_url}; use super::error::FhError; @@ -198,10 +198,10 @@ impl FlakeHubClient { include_token: bool, ) -> Result { let FlakeOutputRef { - ref org, - project: ref flake, - ref version_constraint, - ref attr_path, + org, + project: flake, + version_constraint, + attr_path, } = output_ref; let mut url = flakehub_url!( @@ -407,15 +407,14 @@ async fn make_base_client(authenticated: bool) -> Result { let mut headers = HeaderMap::new(); headers.insert(ACCEPT, HeaderValue::from_static("application/json")); - if authenticated { - if let Ok(token) = tokio::fs::read_to_string(user_auth_token_read_path().await?).await { - if !token.is_empty() { - headers.insert( - AUTHORIZATION, - HeaderValue::from_str(&format!("Bearer {}", token.trim()))?, - ); - } - } + if authenticated + && let Ok(token) = tokio::fs::read_to_string(user_auth_token_read_path().await?).await + && !token.is_empty() + { + headers.insert( + AUTHORIZATION, + HeaderValue::from_str(&format!("Bearer {}", token.trim()))?, + ); } Ok(reqwest::Client::builder() @@ -571,7 +570,9 @@ async fn copy_supports_out_link() -> color_eyre::Result { let error_line = match error_line { Some(line) => line, None => { - tracing::warn!("Could not determine if `nix copy` supports --out-link; falling back to manual links"); + tracing::warn!( + "Could not determine if `nix copy` supports --out-link; falling back to manual links" + ); return Ok(false); } }; From 010c7430ac2dc0e5cc6d1083a3565db923820db2 Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Sun, 16 Nov 2025 20:17:57 -0300 Subject: [PATCH 2/2] Fix Rust formatting --- src/cli/cmd/add/flake.rs | 25 +++++++++++++-------- src/cli/cmd/apply/mod.rs | 2 +- src/cli/cmd/completion.rs | 2 +- src/cli/cmd/fetch.rs | 2 +- src/cli/cmd/init/handlers/php.rs | 2 +- src/cli/cmd/init/handlers/python.rs | 2 +- src/cli/cmd/init/handlers/ruby.rs | 2 +- src/cli/cmd/init/handlers/rust.rs | 18 ++++++++++++--- src/cli/cmd/init/handlers/tools.rs | 28 ++++++++++++++++++----- src/cli/cmd/init/mod.rs | 35 ++++++++++++++++++++--------- src/cli/cmd/init/prompt.rs | 6 +++-- src/cli/cmd/list.rs | 4 ++-- src/cli/cmd/resolve.rs | 2 +- src/cli/cmd/search.rs | 2 +- src/cli/instrumentation.rs | 2 +- src/dnixd.rs | 2 +- src/main.rs | 2 +- 17 files changed, 95 insertions(+), 43 deletions(-) diff --git a/src/cli/cmd/add/flake.rs b/src/cli/cmd/add/flake.rs index 2ce28b6..2cf088f 100644 --- a/src/cli/cmd/add/flake.rs +++ b/src/cli/cmd/add/flake.rs @@ -1,6 +1,6 @@ use std::collections::VecDeque; -use tracing::{span, Level}; +use tracing::{Level, span}; const NEWLINE: &str = "\n"; @@ -285,7 +285,7 @@ impl std::str::FromStr for InputsInsertionLocation { _ => { return Err(color_eyre::eyre::eyre!( "only `top` and `bottom` are valid insertion locations" - )) + )); } }) } @@ -474,7 +474,9 @@ impl AttrType { .iter() .any(|arg| &*arg.identifier == flake_input_name) { - tracing::debug!("input {flake_input_name} was already in the `outputs` function args, not adding it again"); + tracing::debug!( + "input {flake_input_name} was already in the `outputs` function args, not adding it again" + ); return Ok(new_flake_contents); } @@ -505,8 +507,8 @@ impl AttrType { new_flake_contents.insert_str(start, &span_text); } else { return Err(color_eyre::eyre::eyre!( - "could not find `{final_arg_identifier}` in the outputs function, but it existed when parsing it" - ))?; + "could not find `{final_arg_identifier}` in the outputs function, but it existed when parsing it" + ))?; } } None => { @@ -521,12 +523,14 @@ impl AttrType { new_flake_contents.insert_str(start, &span_text); } else { return Err(color_eyre::eyre::eyre!( - "could not find the ellipsis (`...`) in the outputs function, but it existed when parsing it" - ))?; + "could not find the ellipsis (`...`) in the outputs function, but it existed when parsing it" + ))?; } } else { // unfortunately this is legal, but I don't wanna support it - return Err(color_eyre::eyre::eyre!("the `outputs` function doesn't take any arguments, and fh add doesn't support that yet. Replace it with: outputs = {{ ... }}: and try again."))?; + return Err(color_eyre::eyre::eyre!( + "the `outputs` function doesn't take any arguments, and fh add doesn't support that yet. Replace it with: outputs = {{ ... }}: and try again." + ))?; } } } @@ -1058,6 +1062,9 @@ mod test { }) .unwrap(); - assert!(wezterm_line_idx < nixpkgs_input_idx, "when inserting at the bottom, the new nixpkgs input should have come after the wezterm input"); + assert!( + wezterm_line_idx < nixpkgs_input_idx, + "when inserting at the bottom, the new nixpkgs input should have come after the wezterm input" + ); } } diff --git a/src/cli/cmd/apply/mod.rs b/src/cli/cmd/apply/mod.rs index 0e46077..fa381b5 100644 --- a/src/cli/cmd/apply/mod.rs +++ b/src/cli/cmd/apply/mod.rs @@ -10,7 +10,7 @@ use std::{ use clap::{Parser, Subcommand}; use color_eyre::eyre::Context; -use tempfile::{tempdir, TempDir}; +use tempfile::{TempDir, tempdir}; use crate::{ cli::{ diff --git a/src/cli/cmd/completion.rs b/src/cli/cmd/completion.rs index 88d405e..529a6b5 100644 --- a/src/cli/cmd/completion.rs +++ b/src/cli/cmd/completion.rs @@ -2,7 +2,7 @@ use std::{io::stdout, process::ExitCode}; use crate::cli::Cli; use clap::{CommandFactory, Parser}; -use clap_complete::{generate, Shell}; +use clap_complete::{Shell, generate}; use super::CommandExecute; diff --git a/src/cli/cmd/fetch.rs b/src/cli/cmd/fetch.rs index 742fd12..f4bec72 100644 --- a/src/cli/cmd/fetch.rs +++ b/src/cli/cmd/fetch.rs @@ -1,8 +1,8 @@ use std::process::ExitCode; use clap::Parser; -use color_eyre::eyre; use color_eyre::Result; +use color_eyre::eyre; use crate::cli::cmd::copy_closure_with_gc_root; use crate::shared::create_temp_netrc; diff --git a/src/cli/cmd/init/handlers/php.rs b/src/cli/cmd/init/handlers/php.rs index 5bbdaa0..ba59393 100644 --- a/src/cli/cmd/init/handlers/php.rs +++ b/src/cli/cmd/init/handlers/php.rs @@ -1,6 +1,6 @@ use crate::cli::cmd::init::{project::Project, prompt::Prompt}; -use super::{version_as_attr_default, Flake, Handler, Input}; +use super::{Flake, Handler, Input, version_as_attr_default}; const PHP_VERSIONS: &[&str] = &["8.3", "8.2", "8.1", "8.0", "7.4", "7.3"]; diff --git a/src/cli/cmd/init/handlers/python.rs b/src/cli/cmd/init/handlers/python.rs index e631ff5..a5603da 100644 --- a/src/cli/cmd/init/handlers/python.rs +++ b/src/cli/cmd/init/handlers/python.rs @@ -1,6 +1,6 @@ use crate::cli::cmd::init::{project::Project, prompt::Prompt}; -use super::{version_as_attr_default, Flake, Handler}; +use super::{Flake, Handler, version_as_attr_default}; const PYTHON_VERSIONS: &[&str] = &["3.11", "3.10", "3.9"]; const PYTHON_TOOLS: &[&str] = &["pip", "virtualenv", "pipenv"]; diff --git a/src/cli/cmd/init/handlers/ruby.rs b/src/cli/cmd/init/handlers/ruby.rs index 2ee1bf4..9fbdfcb 100644 --- a/src/cli/cmd/init/handlers/ruby.rs +++ b/src/cli/cmd/init/handlers/ruby.rs @@ -1,6 +1,6 @@ use crate::cli::cmd::init::{project::Project, prompt::Prompt}; -use super::{version_as_attr, Flake, Handler}; +use super::{Flake, Handler, version_as_attr}; const RUBY_VERSIONS: &[&str] = &["3.2", "3.1"]; diff --git a/src/cli/cmd/init/handlers/rust.rs b/src/cli/cmd/init/handlers/rust.rs index e2c4c79..31e8bd0 100644 --- a/src/cli/cmd/init/handlers/rust.rs +++ b/src/cli/cmd/init/handlers/rust.rs @@ -73,15 +73,27 @@ impl Handler for Rust { .insert(String::from("RUST_BACKTRACE"), String::from("1")); } - if project.has_file("Cross.toml") && Prompt::bool("This project appears to use cross-rs. Would you like to add the cargo-cross tool to your environment?") { + if project.has_file("Cross.toml") + && Prompt::bool( + "This project appears to use cross-rs. Would you like to add the cargo-cross tool to your environment?", + ) + { flake.dev_shell_packages.push(String::from("cargo-cross")); } - if project.has_file("deny.toml") && Prompt::bool("This project appears to use cargo-deny. Would you like to add it to your environment?") { + if project.has_file("deny.toml") + && Prompt::bool( + "This project appears to use cargo-deny. Would you like to add it to your environment?", + ) + { flake.dev_shell_packages.push(String::from("cargo-deny")); } - if project.has_file("audit.toml") && Prompt::bool("This project appears to use cargo-audit. Would you like to add it to your environment?") { + if project.has_file("audit.toml") + && Prompt::bool( + "This project appears to use cargo-audit. Would you like to add it to your environment?", + ) + { flake.dev_shell_packages.push(String::from("cargo-audit")); } } diff --git a/src/cli/cmd/init/handlers/tools.rs b/src/cli/cmd/init/handlers/tools.rs index 1061081..e5bdf3c 100644 --- a/src/cli/cmd/init/handlers/tools.rs +++ b/src/cli/cmd/init/handlers/tools.rs @@ -33,15 +33,29 @@ impl Handler for Tools { } // SaaS deployment tools - if project.has_file("vercel.json") && Prompt::bool("This project appears to deploy to Vercel. Would you like to add the Vercel CLI to your environment?") { - flake.dev_shell_packages.push(String::from("nodePackages.vercel")); + if project.has_file("vercel.json") + && Prompt::bool( + "This project appears to deploy to Vercel. Would you like to add the Vercel CLI to your environment?", + ) + { + flake + .dev_shell_packages + .push(String::from("nodePackages.vercel")); } - if project.has_file("netlify.toml") && Prompt::bool("This project appears to deploy to Netlify. Would you like to add the Netlify CLI to your environment?") { + if project.has_file("netlify.toml") + && Prompt::bool( + "This project appears to deploy to Netlify. Would you like to add the Netlify CLI to your environment?", + ) + { flake.dev_shell_packages.push(String::from("netlify-cli")); } - if project.has_file("fly.toml") && Prompt::bool("This project appears to deploy to Fly. Would you like to add the Fly CLI to your environment?") { + if project.has_file("fly.toml") + && Prompt::bool( + "This project appears to deploy to Fly. Would you like to add the Fly CLI to your environment?", + ) + { flake.dev_shell_packages.push(String::from("flyctl")); } @@ -68,7 +82,11 @@ impl Handler for Tools { } // SQL tools - if project.has_file("sqlx-data.json") && Prompt::bool("This project appears to use sqlx for Rust. Would you like to add the sqlx CLI to your environment?") { + if project.has_file("sqlx-data.json") + && Prompt::bool( + "This project appears to use sqlx for Rust. Would you like to add the sqlx CLI to your environment?", + ) + { flake.dev_shell_packages.push(String::from("sqlx-cli")); } diff --git a/src/cli/cmd/init/mod.rs b/src/cli/cmd/init/mod.rs index 332ee10..1276ed2 100644 --- a/src/cli/cmd/init/mod.rs +++ b/src/cli/cmd/init/mod.rs @@ -11,7 +11,7 @@ use std::{ fs::write, io::IsTerminal, path::PathBuf, - process::{exit, Command, ExitCode}, + process::{Command, ExitCode, exit}, }; use url::Url; @@ -64,7 +64,11 @@ impl CommandExecute for InitSubcommand { } else { let mut flake = Flake::default(); - if self.output.exists() && !Prompt::bool("A flake.nix already exists in the current directory. Would you like to overwrite it?") { + if self.output.exists() + && !Prompt::bool( + "A flake.nix already exists in the current directory. Would you like to overwrite it?", + ) + { println!("Exiting. Let's a build a new flake soon, though :)"); return Ok(ExitCode::SUCCESS); } @@ -146,7 +150,9 @@ impl CommandExecute for InitSubcommand { flake.dev_shell_packages.push(String::from("nixpkgs-fmt")); } - flake.doc_comments = Prompt::bool("Would you like to add doc comments to your flake that explain the meaning of different aspects of the flake?"); + flake.doc_comments = Prompt::bool( + "Would you like to add doc comments to your flake that explain the meaning of different aspects of the flake?", + ); if Prompt::bool("Would you like to add any environment variables?") { loop { @@ -167,16 +173,17 @@ impl CommandExecute for InitSubcommand { } } - if Prompt::bool("Would you like to add a shell hook that runs every time you enter your Nix development environment?") { + if Prompt::bool( + "Would you like to add a shell hook that runs every time you enter your Nix development environment?", + ) { loop { - let hook = Prompt::maybe_string( - "Enter the hook here:", - ); + let hook = Prompt::maybe_string("Enter the hook here:"); if let Some(hook) = hook { flake.shell_hook = Some(hook); break; - } else if !Prompt::bool("You didn't enter a hook. Would you like to try again?") { + } else if !Prompt::bool("You didn't enter a hook. Would you like to try again?") + { break; } } @@ -184,7 +191,9 @@ impl CommandExecute for InitSubcommand { // If the dev shell will be empty, prompt users to ensure that they still want a flake if flake.dev_shell_packages.is_empty() { - if !Prompt::bool("The Nix development environment you've chosen doesn't have any packages in it. Would you still like to create a flake?") { + if !Prompt::bool( + "The Nix development environment you've chosen doesn't have any packages in it. Would you still like to create a flake?", + ) { println!("See you next time!"); } return Ok(ExitCode::SUCCESS); @@ -225,11 +234,15 @@ impl CommandExecute for InitSubcommand { } if !project.has_file(".envrc") - && Prompt::bool("Would you like to add a .envrc file so that you can use direnv in this project?") + && Prompt::bool( + "Would you like to add a .envrc file so that you can use direnv in this project?", + ) { write(PathBuf::from(".envrc"), String::from("use flake"))?; - if Prompt::bool("You'll need to run `direnv allow` to activate direnv in this project. Would you like to do that now?") { + if Prompt::bool( + "You'll need to run `direnv allow` to activate direnv in this project. Would you like to do that now?", + ) { if command_exists("direnv") { Command::new("direnv").arg("allow").output()?; } else { diff --git a/src/cli/cmd/init/prompt.rs b/src/cli/cmd/init/prompt.rs index 7921eb9..6d7ede5 100644 --- a/src/cli/cmd/init/prompt.rs +++ b/src/cli/cmd/init/prompt.rs @@ -1,8 +1,8 @@ use std::{fmt::Display, process::exit}; use inquire::{ - ui::{Color, RenderConfig, StyleSheet, Styled}, Confirm, MultiSelect, Password, Select, Text, + ui::{Color, RenderConfig, StyleSheet, Styled}, }; use once_cell::sync::Lazy; @@ -122,7 +122,9 @@ impl Prompt { } pub(crate) fn for_language(lang: &str) -> bool { - Self::bool(&format!("This seems to be a {lang} project. Would you like to initialize your flake with some standard dependencies for {lang}?")) + Self::bool(&format!( + "This seems to be a {lang} project. Would you like to initialize your flake with some standard dependencies for {lang}?" + )) } pub(crate) fn for_tool(tool: &str) -> bool { diff --git a/src/cli/cmd/list.rs b/src/cli/cmd/list.rs index 284c647..3217c5d 100644 --- a/src/cli/cmd/list.rs +++ b/src/cli/cmd/list.rs @@ -11,7 +11,7 @@ use url::Url; use super::print_json; use crate::{ cli::{ - cmd::{FlakeHubClient, DEFAULT_STYLE}, + cmd::{DEFAULT_STYLE, FlakeHubClient}, error::FhError, }, flakehub_url, @@ -67,7 +67,7 @@ impl TryFrom for Flake { _ => { return Err(FhError::FlakeParse(format!( "flake ref {flake_ref} invalid; must be of the form {{org}}/{{project}}" - ))) + ))); } }; Ok(Self { diff --git a/src/cli/cmd/resolve.rs b/src/cli/cmd/resolve.rs index 31d813f..5f837ab 100644 --- a/src/cli/cmd/resolve.rs +++ b/src/cli/cmd/resolve.rs @@ -3,7 +3,7 @@ use std::process::ExitCode; use clap::Parser; use serde::{Deserialize, Serialize}; -use super::{parse_flake_output_ref, print_json, CommandExecute, FlakeHubClient}; +use super::{CommandExecute, FlakeHubClient, parse_flake_output_ref, print_json}; /// Resolves a FlakeHub flake reference into a store path. #[derive(Debug, Parser)] diff --git a/src/cli/cmd/search.rs b/src/cli/cmd/search.rs index a61eef9..041b4db 100644 --- a/src/cli/cmd/search.rs +++ b/src/cli/cmd/search.rs @@ -7,7 +7,7 @@ use url::Url; use crate::flakehub_url; -use super::{list::FLAKEHUB_WEB_ROOT, print_json, CommandExecute, FlakeHubClient}; +use super::{CommandExecute, FlakeHubClient, list::FLAKEHUB_WEB_ROOT, print_json}; /// Searches FlakeHub for flakes that match your query. #[derive(Debug, Parser)] diff --git a/src/cli/instrumentation.rs b/src/cli/instrumentation.rs index 38b47b2..2041b95 100644 --- a/src/cli/instrumentation.rs +++ b/src/cli/instrumentation.rs @@ -4,7 +4,7 @@ use std::io::IsTerminal; use color_eyre::eyre::WrapErr; use tracing_error::ErrorLayer; use tracing_subscriber::{ - filter::Directive, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, + EnvFilter, filter::Directive, layer::SubscriberExt, util::SubscriberInitExt, }; #[derive(Clone, Default, Debug, clap::ValueEnum)] diff --git a/src/dnixd.rs b/src/dnixd.rs index 5a2622d..40ccc0f 100644 --- a/src/dnixd.rs +++ b/src/dnixd.rs @@ -1,8 +1,8 @@ use std::path::{Path, PathBuf}; use axum::body::Body; -use color_eyre::eyre::eyre; use color_eyre::eyre::WrapErr; +use color_eyre::eyre::eyre; use hyper::client::conn::http1::SendRequest; use hyper::{Method, StatusCode}; use hyper_util::rt::TokioIo; diff --git a/src/main.rs b/src/main.rs index f99ad60..1d063fb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,8 +7,8 @@ use std::io::IsTerminal; use clap::Parser; use crate::cli::{ - cmd::{CommandExecute, FhSubcommands}, Cli, + cmd::{CommandExecute, FhSubcommands}, }; const DETERMINATE_STATE_DIR: &str = "/nix/var/determinate";