Skip to content

some ux improvements to push#213

Open
john (j13huang) wants to merge 2 commits into
mainfrom
debug-ux-tweaks
Open

some ux improvements to push#213
john (j13huang) wants to merge 2 commits into
mainfrom
debug-ux-tweaks

Conversation

@j13huang

Copy link
Copy Markdown
Contributor

Some things:

  • handle duplicate slug detected error with a custom message
  • some more verbose logging
  • show which names/slugs are getting pushed in the confirmation prompt

@github-actions

Copy link
Copy Markdown
Contributor

Latest downloadable build artifacts for this PR commit 6b55805ddb05:

Available artifact names
  • ``artifacts-build-global
  • ``artifacts-build-local-aarch64-pc-windows-msvc
  • ``artifacts-build-local-x86_64-pc-windows-msvc
  • ``artifacts-build-local-x86_64-apple-darwin
  • ``artifacts-build-local-x86_64-unknown-linux-musl
  • ``artifacts-build-local-x86_64-unknown-linux-gnu
  • ``artifacts-build-local-aarch64-apple-darwin
  • ``artifacts-build-local-aarch64-unknown-linux-gnu
  • ``artifacts-plan-dist-manifest
  • ``cargo-dist-cache

Copy link
Copy Markdown
Contributor

Swapping Cedric / ViaDézo1er (@viadezo1er) in for me since I haven't touched the CLI in a while and am out of date on it.

@viadezo1er

Copy link
Copy Markdown
Contributor

cargo clippy --fix then git diff:

diff --git a/src/functions/pull.rs b/src/functions/pull.rs
index 8f2e6de..0b51ef2 100644
--- a/src/functions/pull.rs
+++ b/src/functions/pull.rs
@@ -1410,7 +1410,7 @@ fn format_py_value_inner(value: &Value, depth: usize) -> String {
             let closing_indent = "    ".repeat(depth);
             let mut out = String::from("{\n");
             let mut entries = object.iter().collect::<Vec<_>>();
-            entries.sort_by(|(left, _), (right, _)| left.cmp(right));
+            entries.sort_by_key(|(left, _)| *left);
             for (index, (key, val)) in entries.into_iter().enumerate() {
                 out.push_str(&indent);
                 out.push_str(&serde_json::to_string(key).unwrap_or_else(|_| "\"\"".to_string()));
diff --git a/src/sql.rs b/src/sql.rs
index 4e4b4ac..f6619e4 100644
--- a/src/sql.rs
+++ b/src/sql.rs
@@ -258,11 +258,10 @@ fn handle_key_event(
         KeyCode::End => app.move_end(),
         KeyCode::Up => app.history_prev(),
         KeyCode::Down => app.history_next(),
-        KeyCode::Char(ch) if !key.modifiers.contains(KeyModifiers::CONTROL) => {
-            if !key.modifiers.contains(KeyModifiers::ALT) {
+        KeyCode::Char(ch) if !key.modifiers.contains(KeyModifiers::CONTROL)
+            && !key.modifiers.contains(KeyModifiers::ALT) => {
                 app.insert_char(ch);
             }
-        }
         _ => {}
     }
 
diff --git a/src/traces.rs b/src/traces.rs
index 94e0b3d..c136548 100644
--- a/src/traces.rs
+++ b/src/traces.rs
@@ -2084,8 +2084,8 @@ fn handle_span_detail_key(
                 }
             }
         }
-        KeyCode::Char('d') if key.modifiers.contains(KeyModifiers::CONTROL) => {
-            if app.detail_pane_focus == DetailPaneFocus::Detail {
+        KeyCode::Char('d') if key.modifiers.contains(KeyModifiers::CONTROL)
+            && app.detail_pane_focus == DetailPaneFocus::Detail => {
                 if detail_message_list_mode {
                     if app.detail_view == DetailView::Thread {
                         for _ in 0..10 {
@@ -2100,7 +2100,6 @@ fn handle_span_detail_key(
                     scroll_detail_down_bounded(app, 10)
                 }
             }
-        }
         _ => {}
     }
     Ok(())
@@ -5229,11 +5228,10 @@ fn parse_trace_url(input: &str) -> Result<ParsedTraceUrl> {
                     parsed.span_id = Some(value.to_string());
                 }
             }
-            "tvt" => {
-                if !value.is_empty() {
+            "tvt"
+                if !value.is_empty() => {
                     parsed.trace_view_type = Some(value.to_string());
                 }
-            }
             _ => {}
         }
     }

@viadezo1er

Copy link
Copy Markdown
Contributor

After cargo clippy --fix, cargo clippy:

warning: large size difference between variants
   --> src/topics/mod.rs:194:1
    |
194 | / enum TopicMapCommands {
195 | |     /// Show a configured Topics topic map by name or function ID
196 | |     #[command(alias = "view")]
197 | |     Show(TopicMapViewArgs),
    | |     ---------------------- the second-largest variant contains at least 48 bytes
198 | |     /// Update a configured Topics topic map by name or function ID
199 | |     Set(TopicMapSetArgs),
    | |     -------------------- the largest variant contains at least 304 bytes
200 | | }
    | |_^ the entire enum is at least 304 bytes
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#large_enum_variant
    = note: `#[warn(clippy::large_enum_variant)]` on by default
help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum
    |
199 -     Set(TopicMapSetArgs),
199 +     Set(Box<TopicMapSetArgs>),
    |

warning: `bt` (bin "bt") generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.18s

@viadezo1er

Copy link
Copy Markdown
Contributor

Nitpicks but easy to fix (run the command/throw the warning at the llm).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants