fix(cli): use map_or_else when loading managed sessions
Resolves clippy::map_unwrap_or in main.rs. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
29b99b21f7
commit
e9a571ae57
1 changed files with 11 additions and 12 deletions
|
|
@ -2058,7 +2058,17 @@ fn list_managed_sessions() -> Result<Vec<ManagedSessionSummary>, Box<dyn std::er
|
||||||
.map(|duration| duration.as_secs())
|
.map(|duration| duration.as_secs())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let (id, message_count, parent_session_id, branch_name) = Session::load_from_path(&path)
|
let (id, message_count, parent_session_id, branch_name) = Session::load_from_path(&path)
|
||||||
.map(|session| {
|
.map_or_else(|_| {
|
||||||
|
(
|
||||||
|
path.file_stem()
|
||||||
|
.and_then(|value| value.to_str())
|
||||||
|
.unwrap_or("unknown")
|
||||||
|
.to_string(),
|
||||||
|
0,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
}, |session| {
|
||||||
let parent_session_id = session
|
let parent_session_id = session
|
||||||
.fork
|
.fork
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|
@ -2073,17 +2083,6 @@ fn list_managed_sessions() -> Result<Vec<ManagedSessionSummary>, Box<dyn std::er
|
||||||
parent_session_id,
|
parent_session_id,
|
||||||
branch_name,
|
branch_name,
|
||||||
)
|
)
|
||||||
})
|
|
||||||
.unwrap_or_else(|_| {
|
|
||||||
(
|
|
||||||
path.file_stem()
|
|
||||||
.and_then(|value| value.to_str())
|
|
||||||
.unwrap_or("unknown")
|
|
||||||
.to_string(),
|
|
||||||
0,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
sessions.push(ManagedSessionSummary {
|
sessions.push(ManagedSessionSummary {
|
||||||
id,
|
id,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue