Skip to content

Commit 53eb160

Browse files
committed
Apply clippy things
1 parent 62aa322 commit 53eb160

File tree

5 files changed

+18
-22
lines changed

5 files changed

+18
-22
lines changed

src/app.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -676,12 +676,9 @@ impl App {
676676
self.workspace.reset();
677677
}
678678

679-
fn recenter(&mut self) -> () {
679+
fn recenter(&mut self) {
680680
let entry = self.history.current();
681-
match entry {
682-
Some(entry) => self.session_view.scroll_to_line(entry.source(self.session_view.stack_depth()).line_no),
683-
None => (),
684-
}
681+
if let Some(entry) = entry { self.session_view.scroll_to_line(entry.source(self.session_view.stack_depth()).line_no) }
685682
}
686683
}
687684

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ mod test {
4040
use crate::notification::Notification;
4141

4242
#[test]
43-
fn test_countdown_char() -> () {
43+
fn test_countdown_char() {
4444
let notification = Notification::info("Hello".to_string());
4545
notification.countdown_char();
4646
}

src/dbgp/client.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl DbgpClient {
212212
}
213213

214214
pub(crate) async fn run(&mut self) -> Result<ContinuationResponse> {
215-
match self.command("run", &mut vec![]).await? {
215+
match self.command("run", &mut []).await? {
216216
Message::Response(r) => match r.command {
217217
CommandResponse::Run(s) => Ok(s),
218218
_ => anyhow::bail!("Unexpected response"),
@@ -223,7 +223,7 @@ impl DbgpClient {
223223

224224
pub(crate) async fn feature_set(&mut self, feature: &str, value: &str) -> Result<()> {
225225
match self
226-
.command("feature_set", &mut vec!["-n", feature, "-v", value])
226+
.command("feature_set", &mut ["-n", feature, "-v", value])
227227
.await?
228228
{
229229
Message::Response(r) => match r.command {
@@ -235,7 +235,7 @@ impl DbgpClient {
235235
}
236236

237237
pub(crate) async fn context_get(&mut self, depth: u16) -> Result<ContextGetResponse> {
238-
match self.command("context_get", &mut vec!["-d", format!("{}", depth).as_str()]).await? {
238+
match self.command("context_get", &mut ["-d", format!("{}", depth).as_str()]).await? {
239239
Message::Response(r) => match r.command {
240240
CommandResponse::ContextGet(s) => Ok(s),
241241
_ => anyhow::bail!("Unexpected response"),
@@ -245,7 +245,7 @@ impl DbgpClient {
245245
}
246246

247247
pub(crate) async fn step_into(&mut self) -> Result<ContinuationResponse> {
248-
match self.command("step_into", &mut vec![]).await? {
248+
match self.command("step_into", &mut []).await? {
249249
Message::Response(r) => match r.command {
250250
CommandResponse::StepInto(s) => Ok(s),
251251
_ => anyhow::bail!("Unexpected response"),
@@ -255,7 +255,7 @@ impl DbgpClient {
255255
}
256256

257257
pub(crate) async fn step_out(&mut self) -> Result<ContinuationResponse> {
258-
match self.command("step_out", &mut vec![]).await? {
258+
match self.command("step_out", &mut []).await? {
259259
Message::Response(r) => match r.command {
260260
CommandResponse::StepInto(s) => Ok(s),
261261
_ => anyhow::bail!("Unexpected response"),
@@ -265,7 +265,7 @@ impl DbgpClient {
265265
}
266266

267267
pub(crate) async fn step_over(&mut self) -> Result<ContinuationResponse> {
268-
match self.command("step_over", &mut vec![]).await? {
268+
match self.command("step_over", &mut []).await? {
269269
Message::Response(r) => match r.command {
270270
CommandResponse::StepOver(s) => Ok(s),
271271
_ => anyhow::bail!("Unexpected response"),
@@ -275,7 +275,7 @@ impl DbgpClient {
275275
}
276276

277277
pub(crate) async fn get_stack(&mut self) -> Result<StackGetResponse> {
278-
match self.command("stack_get", &mut vec!["-n 0"]).await? {
278+
match self.command("stack_get", &mut ["-n 0"]).await? {
279279
Message::Response(r) => match r.command {
280280
CommandResponse::StackGet(s) => Ok(s),
281281
_ => anyhow::bail!("Unexpected response"),
@@ -286,7 +286,7 @@ impl DbgpClient {
286286

287287
pub(crate) async fn source(&mut self, filename: String) -> Result<String> {
288288
match self
289-
.command("source", &mut vec![format!("-f {}", filename).as_str()])
289+
.command("source", &mut [format!("-f {}", filename).as_str()])
290290
.await?
291291
{
292292
Message::Response(r) => match r.command {
@@ -297,12 +297,12 @@ impl DbgpClient {
297297
}
298298
}
299299

300-
async fn command(&mut self, cmd: &str, args: &mut Vec<&str>) -> Result<Message> {
300+
async fn command(&mut self, cmd: &str, args: &mut [&str]) -> Result<Message> {
301301
self.command_raw(cmd, args).await?;
302302
self.read_and_parse().await
303303
}
304304

305-
async fn command_raw(&mut self, cmd: &str, args: &mut Vec<&str>) -> Result<usize> {
305+
async fn command_raw(&mut self, cmd: &str, args: &mut [&str]) -> Result<usize> {
306306
let cmd_str = format!("{} -i {} {}", cmd, self.tid, args.join(" "));
307307
debug!("[dbgp] >> {}", cmd_str);
308308
let bytes = [cmd_str.trim_end(), "\0"].concat();

src/notification.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ mod test {
7878
use pretty_assertions::assert_eq;
7979

8080
#[test]
81-
fn test_countdown_char() -> () {
81+
fn test_countdown_char() {
8282
let notification = Notification::info("hello".to_string());
8383
assert_eq!('█', notification.countdown_char());
8484

src/view/session.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use crate::app::App;
1212
use crate::app::ListenStatus;
1313
use crate::app::SelectedView;
1414
use crate::event::input::AppEvent;
15-
use clap::builder::ArgPredicate;
1615
use crossterm::event::KeyCode;
1716
use ratatui::layout::Constraint;
1817
use ratatui::layout::Layout;
@@ -137,7 +136,7 @@ fn split_rows(panes: &Vec<&Pane>, area: Rect) -> Rc<[Rect]> {
137136
vertical_constraints.push(pane.constraint);
138137
}
139138

140-
return Layout::vertical(vertical_constraints).split(area);
139+
Layout::vertical(vertical_constraints).split(area)
141140
}
142141

143142
fn delegate_event_to_pane(app: &mut App, event: AppEvent) -> Option<AppEvent> {
@@ -294,7 +293,7 @@ impl SessionViewState {
294293
self.stack_scroll.0
295294
}
296295

297-
pub(crate) fn scroll_to_line(&mut self, line_no: u32) -> () {
296+
pub(crate) fn scroll_to_line(&mut self, line_no: u32) {
298297
let area = self.source_area.get();
299298
let mid_point = (area.height as u32).div_ceil(2);
300299
let offset = if line_no > mid_point {
@@ -318,7 +317,7 @@ mod test {
318317
use super::*;
319318

320319
#[test]
321-
pub fn panes() -> () {
320+
pub fn panes() {
322321
let mut view = SessionViewState::default();
323322
view.panes = vec![
324323
Pane{ component_type: ComponentType::Stack, constraint: Constraint::Min(1), col: Col::Left},
@@ -330,7 +329,7 @@ mod test {
330329
}
331330

332331
#[test]
333-
pub fn scroll_to_line() -> () {
332+
pub fn scroll_to_line() {
334333
let mut view = SessionViewState::default();
335334
view.source_area = Cell::new(Rect{
336335
x: 0,

0 commit comments

Comments
 (0)