Run cargo +nightly fmt

This commit is contained in:
Josh McKinney
2025-11-05 17:34:26 -08:00
parent c67908ba17
commit 6fc8a9308a
424 changed files with 3097 additions and 5253 deletions
+7 -7
View File
@@ -6,12 +6,12 @@
//! mode via [`ApplyGitRequest::preflight`] and inspect the resulting paths to
//! learn what would change before applying for real.
use once_cell::sync::Lazy;
use regex::Regex;
use std::ffi::OsStr;
use std::io;
use std::path::Path;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use once_cell::sync::Lazy;
use regex::Regex;
/// Parameters for invoking [`apply_git_patch`].
#[derive(Debug, Clone)]
@@ -492,10 +492,10 @@ fn regex_ci(pat: &str) -> Regex {
#[cfg(test)]
mod tests {
use super::*;
use std::path::Path;
use std::sync::Mutex;
use std::sync::OnceLock;
use std::sync::{Mutex, OnceLock};
use super::*;
fn env_lock() -> &'static Mutex<()> {
static LOCK: OnceLock<Mutex<()>> = OnceLock::new();
+13 -18
View File
@@ -1,23 +1,16 @@
use std::collections::HashSet;
use std::ffi::OsString;
use std::fs;
use std::io;
use std::path::Path;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::{fs, io};
use tempfile::Builder;
use crate::GhostCommit;
use crate::GitToolingError;
use crate::operations::apply_repo_prefix_to_force_include;
use crate::operations::ensure_git_repository;
use crate::operations::normalize_relative_path;
use crate::operations::repo_subdir;
use crate::operations::resolve_head;
use crate::operations::resolve_repository_root;
use crate::operations::run_git_for_status;
use crate::operations::run_git_for_stdout;
use crate::operations::run_git_for_stdout_all;
use crate::operations::{
apply_repo_prefix_to_force_include, ensure_git_repository, normalize_relative_path,
repo_subdir, resolve_head, resolve_repository_root, run_git_for_status, run_git_for_stdout,
run_git_for_stdout_all,
};
use crate::{GhostCommit, GitToolingError};
/// Default commit message used for ghost commits when none is provided.
const DEFAULT_COMMIT_MESSAGE: &str = "codex snapshot";
@@ -356,11 +349,13 @@ fn default_commit_identity() -> Vec<(OsString, OsString)> {
#[cfg(test)]
mod tests {
use super::*;
use crate::operations::run_git_for_stdout;
use std::process::Command;
use assert_matches::assert_matches;
use pretty_assertions::assert_eq;
use std::process::Command;
use super::*;
use crate::operations::run_git_for_stdout;
/// Runs a git command in the test repository and asserts success.
fn run_git_in(repo_path: &Path, args: &[&str]) {
+8 -12
View File
@@ -7,21 +7,17 @@ mod ghost_commits;
mod operations;
mod platform;
pub use apply::ApplyGitRequest;
pub use apply::ApplyGitResult;
pub use apply::apply_git_patch;
pub use apply::extract_paths_from_patch;
pub use apply::parse_git_apply_output;
pub use apply::stage_paths;
pub use apply::{
ApplyGitRequest, ApplyGitResult, apply_git_patch, extract_paths_from_patch,
parse_git_apply_output, stage_paths,
};
pub use errors::GitToolingError;
pub use ghost_commits::CreateGhostCommitOptions;
pub use ghost_commits::create_ghost_commit;
pub use ghost_commits::restore_ghost_commit;
pub use ghost_commits::restore_to_commit;
pub use ghost_commits::{
CreateGhostCommitOptions, create_ghost_commit, restore_ghost_commit, restore_to_commit,
};
pub use platform::create_symlink;
use schemars::JsonSchema;
use serde::Deserialize;
use serde::Serialize;
use serde::{Deserialize, Serialize};
use ts_rs::TS;
type CommitID = String;
+2 -5
View File
@@ -1,8 +1,5 @@
use std::ffi::OsStr;
use std::ffi::OsString;
use std::path::Component;
use std::path::Path;
use std::path::PathBuf;
use std::ffi::{OsStr, OsString};
use std::path::{Component, Path, PathBuf};
use std::process::Command;
use crate::GitToolingError;
+1 -3
View File
@@ -20,9 +20,7 @@ pub fn create_symlink(
link_target: &Path,
destination: &Path,
) -> Result<(), GitToolingError> {
use std::os::windows::fs::FileTypeExt;
use std::os::windows::fs::symlink_dir;
use std::os::windows::fs::symlink_file;
use std::os::windows::fs::{FileTypeExt, symlink_dir, symlink_file};
let metadata = std::fs::symlink_metadata(source)?;
if metadata.file_type().is_symlink_dir() {