Skip to content

Commit fa2e324

Browse files
committed
Format and lint
1 parent e1efefa commit fa2e324

27 files changed

+302
-227
lines changed

crates/but-api/src/commands/askpass.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ pub async fn submit_prompt_response(
1616
_ipc_ctx: &IpcContext,
1717
params: SubmitPromptResponseParams,
1818
) -> Result<(), Error> {
19-
askpass::get_broker().handle_response(params.id, params.response).await;
19+
askpass::get_broker()
20+
.handle_response(params.id, params.response)
21+
.await;
2022
Ok(())
21-
}
23+
}

crates/but-api/src/commands/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@ pub fn cli_path(_ipc_ctx: &IpcContext, _params: NoParams) -> Result<String, Erro
9898
.map_err(|e| e.into());
9999
}
100100
Ok(cli_path.to_string_lossy().to_string())
101-
}
101+
}

crates/but-api/src/commands/forge.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ use std::path::Path;
44
use anyhow::Context;
55
use gitbutler_forge::{
66
forge::ForgeName,
7-
review::{
8-
available_review_templates, get_review_template_functions, ReviewTemplateFunctions,
9-
},
7+
review::{ReviewTemplateFunctions, available_review_templates, get_review_template_functions},
108
};
119
use gitbutler_project::ProjectId;
1210
use gitbutler_repo::RepoCommands;
@@ -37,10 +35,7 @@ pub struct PrTemplateParams {
3735
pub forge: ForgeName,
3836
}
3937

40-
pub fn pr_template(
41-
_ipc_ctx: &IpcContext,
42-
params: PrTemplateParams,
43-
) -> Result<String, Error> {
38+
pub fn pr_template(_ipc_ctx: &IpcContext, params: PrTemplateParams) -> Result<String, Error> {
4439
let project = gitbutler_project::get_validated(params.project_id)?;
4540

4641
let ReviewTemplateFunctions {
@@ -59,4 +54,4 @@ pub fn pr_template(
5954
.read_file_from_workspace(&params.relative_path)?
6055
.content
6156
.context("PR template was not valid UTF-8")?)
62-
}
57+
}

crates/but-api/src/commands/github.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ pub async fn check_auth_status(
9494
.map(|rsp_body| rsp_body.access_token)
9595
.context("Failed to parse response body")
9696
.map_err(Into::into)
97-
}
97+
}

crates/but-api/src/commands/modes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,4 @@ pub fn edit_changes_from_initial(
119119
let ctx = CommandContext::open(&project, ipc_ctx.app_settings.get()?.clone())?;
120120

121121
gitbutler_edit_mode::commands::changes_from_initial(&ctx).map_err(Into::into)
122-
}
122+
}

crates/but-api/src/commands/open.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! In place of commands.rs
2-
use anyhow::{bail, Context};
2+
use anyhow::{Context, bail};
33
use serde::Deserialize;
44
use std::env;
55
use url::Url;
@@ -88,10 +88,7 @@ pub struct OpenUrlParams {
8888
pub url: String,
8989
}
9090

91-
pub fn open_url(
92-
_ipc_ctx: &IpcContext,
93-
params: OpenUrlParams,
94-
) -> Result<(), Error> {
91+
pub fn open_url(_ipc_ctx: &IpcContext, params: OpenUrlParams) -> Result<(), Error> {
9592
Ok(open_that(&params.url)?)
9693
}
9794

@@ -101,10 +98,7 @@ pub struct ShowInFinderParams {
10198
pub path: String,
10299
}
103100

104-
pub fn show_in_finder(
105-
_ipc_ctx: &IpcContext,
106-
params: ShowInFinderParams,
107-
) -> Result<(), Error> {
101+
pub fn show_in_finder(_ipc_ctx: &IpcContext, params: ShowInFinderParams) -> Result<(), Error> {
108102
// Cross-platform implementation to open file/directory in the default file manager
109103
// macOS: Opens in Finder (with -R flag to reveal the item)
110104
// Windows: Opens in File Explorer
@@ -134,8 +128,9 @@ pub fn show_in_finder(
134128
{
135129
// For directories, open the directory directly
136130
if std::path::Path::new(&params.path).is_dir() {
137-
open_that(&params.path)
138-
.with_context(|| format!("Failed to open directory '{}' in file manager", params.path))?;
131+
open_that(&params.path).with_context(|| {
132+
format!("Failed to open directory '{}' in file manager", params.path)
133+
})?;
139134
} else {
140135
// For files, try to open the parent directory
141136
if let Some(parent) = std::path::Path::new(&params.path).parent() {
@@ -154,4 +149,4 @@ pub fn show_in_finder(
154149
}
155150

156151
Ok(())
157-
}
152+
}

crates/but-api/src/commands/projects.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{IpcContext, error::Error};
22
use gitbutler_project::{self as projects, ProjectId};
3-
use std::path::PathBuf;
43
use serde::Deserialize;
4+
use std::path::PathBuf;
55

66
#[derive(Deserialize)]
77
#[serde(rename_all = "camelCase")]
@@ -56,9 +56,6 @@ pub struct DeleteProjectParams {
5656
pub project_id: ProjectId,
5757
}
5858

59-
pub fn delete_project(
60-
_ipc_ctx: &IpcContext,
61-
params: DeleteProjectParams,
62-
) -> Result<(), Error> {
59+
pub fn delete_project(_ipc_ctx: &IpcContext, params: DeleteProjectParams) -> Result<(), Error> {
6360
gitbutler_project::delete(params.project_id).map_err(Into::into)
64-
}
61+
}

crates/but-api/src/commands/remotes.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ pub struct AddRemoteParams {
2727
pub url: String,
2828
}
2929

30-
pub fn add_remote(
31-
_ipc_ctx: &IpcContext,
32-
params: AddRemoteParams,
33-
) -> Result<(), Error> {
30+
pub fn add_remote(_ipc_ctx: &IpcContext, params: AddRemoteParams) -> Result<(), Error> {
3431
let project = gitbutler_project::get(params.project_id)?;
3532
Ok(project.add_remote(&params.name, &params.url)?)
36-
}
33+
}

crates/but-api/src/commands/rules.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! In place of commands.rs
22
use but_rules::{
3-
create_rule, delete_rule, list_rules, update_rule, CreateRuleRequest, UpdateRuleRequest,
4-
WorkspaceRule,
3+
CreateRuleRequest, UpdateRuleRequest, WorkspaceRule, create_rule, delete_rule, list_rules,
4+
update_rule,
55
};
66
use gitbutler_command_context::CommandContext;
77
use gitbutler_project::ProjectId;
@@ -78,4 +78,4 @@ pub fn list_workspace_rules(
7878
ipc_ctx.app_settings.get()?.clone(),
7979
)?;
8080
list_rules(ctx).map_err(Into::into)
81-
}
81+
}

crates/but-api/src/commands/workspace.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use crate::{IpcContext, error::Error};
55
use anyhow::Context;
66
use but_graph::VirtualBranchesTomlMetadata;
77
use but_hunk_assignment::HunkAssignmentRequest;
8-
use but_workspace::commit_engine::StackSegmentId;
98
use but_workspace::MoveChangesResult;
9+
use but_workspace::commit_engine::StackSegmentId;
1010
use but_workspace::{commit_engine, ui::StackEntry};
11-
use gitbutler_branch_actions::{update_workspace_commit, BranchManagerExt};
11+
use gitbutler_branch_actions::{BranchManagerExt, update_workspace_commit};
1212
use gitbutler_command_context::CommandContext;
1313
use gitbutler_oplog::entry::{OperationKind, SnapshotDetails};
1414
use gitbutler_oplog::{OplogExt, SnapshotExt};
@@ -28,18 +28,20 @@ pub struct StacksParams {
2828
pub filter: Option<but_workspace::StacksFilter>,
2929
}
3030

31-
pub fn stacks(
32-
ipc_ctx: &IpcContext,
33-
params: StacksParams,
34-
) -> Result<Vec<StackEntry>, Error> {
31+
pub fn stacks(ipc_ctx: &IpcContext, params: StacksParams) -> Result<Vec<StackEntry>, Error> {
3532
let project = gitbutler_project::get(params.project_id)?;
3633
let ctx = CommandContext::open(&project, ipc_ctx.app_settings.get()?.clone())?;
3734
let repo = ctx.gix_repo_for_merging_non_persisting()?;
3835
if ctx.app_settings().feature_flags.ws3 {
3936
let meta = ref_metadata_toml(ctx.project())?;
4037
but_workspace::stacks_v3(&repo, &meta, params.filter.unwrap_or_default())
4138
} else {
42-
but_workspace::stacks(&ctx, &project.gb_dir(), &repo, params.filter.unwrap_or_default())
39+
but_workspace::stacks(
40+
&ctx,
41+
&project.gb_dir(),
42+
&repo,
43+
params.filter.unwrap_or_default(),
44+
)
4345
}
4446
.map_err(Into::into)
4547
}
@@ -51,10 +53,7 @@ pub struct ShowGraphSvgParams {
5153
}
5254

5355
#[cfg(unix)]
54-
pub fn show_graph_svg(
55-
ipc_ctx: &IpcContext,
56-
params: ShowGraphSvgParams,
57-
) -> Result<(), Error> {
56+
pub fn show_graph_svg(ipc_ctx: &IpcContext, params: ShowGraphSvgParams) -> Result<(), Error> {
5857
let project = gitbutler_project::get(params.project_id)?;
5958
let ctx = CommandContext::open(&project, ipc_ctx.app_settings.get()?.clone())?;
6059
let repo = ctx.gix_repo_minimal()?;
@@ -149,7 +148,12 @@ pub fn branch_details(
149148
.map_err(anyhow::Error::from)?;
150149
but_workspace::branch_details_v3(&repo, ref_name.as_ref(), &meta)
151150
} else {
152-
but_workspace::branch_details(&project.gb_dir(), &params.branch_name, params.remote.as_deref(), &ctx)
151+
but_workspace::branch_details(
152+
&project.gb_dir(),
153+
&params.branch_name,
154+
params.remote.as_deref(),
155+
&ctx,
156+
)
153157
}
154158
.map_err(Into::into)
155159
}
@@ -620,4 +624,4 @@ pub fn target_commits(
620624
params.page_size.unwrap_or(30),
621625
)
622626
.map_err(Into::into)
623-
}
627+
}

0 commit comments

Comments
 (0)