Skip to content

Commit 08d9739

Browse files
committed
Resolve conflicts & clippy fmt
1 parent a25c09b commit 08d9739

File tree

6 files changed

+47
-17
lines changed

6 files changed

+47
-17
lines changed

crates/chat-cli/src/cli/chat/cli/usage/mod.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
use clap::Args;
22

33
use crate::cli::chat::token_counter::TokenCount;
4-
use crate::cli::chat::{ChatError, ChatSession, ChatState};
4+
use crate::cli::chat::{
5+
ChatError,
6+
ChatSession,
7+
ChatState,
8+
};
59
use crate::os::Os;
610

711
pub mod usage_data_provider;
@@ -32,6 +36,8 @@ impl UsageArgs {
3236
pub async fn execute(self, os: &Os, session: &mut ChatSession) -> Result<ChatState, ChatError> {
3337
let usage_data = usage_data_provider::get_detailed_usage_data(session, os).await?;
3438
usage_renderer::render_context_window(&usage_data, session).await?;
35-
Ok(ChatState::PromptUser { skip_printing_tools: true })
39+
Ok(ChatState::PromptUser {
40+
skip_printing_tools: true,
41+
})
3642
}
37-
}
43+
}

crates/chat-cli/src/cli/chat/cli/usage/usage_data_provider.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
use crate::cli::chat::cli::model::context_window_tokens;
2-
use crate::cli::chat::token_counter::{CharCount, TokenCount};
3-
use crate::cli::chat::{ChatError, ChatSession};
2+
use crate::cli::chat::token_counter::{
3+
CharCount,
4+
TokenCount,
5+
};
6+
use crate::cli::chat::{
7+
ChatError,
8+
ChatSession,
9+
};
410
use crate::os::Os;
511

612
/// Get detailed usage data for context window analysis
7-
pub(super) async fn get_detailed_usage_data(session: &mut ChatSession, os: &Os) -> Result<super::DetailedUsageData, ChatError> {
13+
pub(super) async fn get_detailed_usage_data(
14+
session: &mut ChatSession,
15+
os: &Os,
16+
) -> Result<super::DetailedUsageData, ChatError> {
817
let context_window_size = context_window_tokens(session.conversation.model_info.as_ref());
918

1019
let state = session

crates/chat-cli/src/cli/chat/cli/usage/usage_renderer.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
use crossterm::style::Attribute;
2-
use crossterm::{execute, queue, style};
2+
use crossterm::{
3+
execute,
4+
queue,
5+
style,
6+
};
37

48
use crate::cli::chat::token_counter::TokenCount;
5-
use crate::cli::chat::{ChatError, ChatSession};
9+
use crate::cli::chat::{
10+
ChatError,
11+
ChatSession,
12+
};
613
use crate::theme::StyledText;
714

815
/// Calculate usage percentage from token counts (private utility)
@@ -11,7 +18,10 @@ fn calculate_usage_percentage(tokens: TokenCount, context_window_size: usize) ->
1118
}
1219

1320
/// Render context window information section
14-
pub async fn render_context_window(usage_data: &super::DetailedUsageData, session: &mut ChatSession) -> Result<(), ChatError> {
21+
pub async fn render_context_window(
22+
usage_data: &super::DetailedUsageData,
23+
session: &mut ChatSession,
24+
) -> Result<(), ChatError> {
1525
if !usage_data.dropped_context_files.is_empty() {
1626
execute!(
1727
session.stderr,

crates/chat-cli/src/mcp_client/client.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ use crate::cli::chat::tools::custom_tool::{
5959
TransportType,
6060
};
6161
use crate::os::Os;
62-
<<<<<<< HEAD
63-
use crate::util::directories::DirectoryError;
6462
use crate::util::env_var::get_all_env_vars;
6563

6664
/// Fetches all pages of specified resources from a server
@@ -142,8 +140,6 @@ pub enum McpClientError {
142140
#[error("Client has not finished initializing")]
143141
NotReady,
144142
#[error(transparent)]
145-
Directory(#[from] DirectoryError),
146-
#[error(transparent)]
147143
OauthUtil(#[from] OauthUtilError),
148144
#[error(transparent)]
149145
Parse(#[from] url::ParseError),

crates/chat-cli/src/util/env_var.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::ffi::OsString;
2+
23
use crate::os::Env;
34

45
/// Get environment variable as String

crates/chat-cli/src/util/file_uri.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,24 @@ mod tests {
153153
// the expansion behavior using error messages
154154
let uri = "file://~/test.txt";
155155
let base = Path::new("/some/other/path");
156-
156+
157157
// This will fail to find the file (expected), but the error should show
158158
// an expanded absolute path, not a path with literal ~
159159
let result = resolve_file_uri(uri, base);
160-
160+
161161
match result {
162162
Err(FileUriError::FileNotFound { path }) => {
163163
// Verify the path was expanded (should start with / not ~)
164-
assert!(path.starts_with("/"), "Path should be absolute after tilde expansion, got: {:?}", path);
165-
assert!(!path.to_string_lossy().contains("~"), "Path should not contain literal tilde, got: {:?}", path);
164+
assert!(
165+
path.starts_with("/"),
166+
"Path should be absolute after tilde expansion, got: {:?}",
167+
path
168+
);
169+
assert!(
170+
!path.to_string_lossy().contains("~"),
171+
"Path should not contain literal tilde, got: {:?}",
172+
path
173+
);
166174
},
167175
_ => panic!("Expected FileNotFound error"),
168176
}

0 commit comments

Comments
 (0)