Fix clippy warnings and fix CI to fail when have warnings. (#301)

This commit is contained in:
Jason Lee 2024-10-03 10:46:02 +08:00 committed by GitHub
parent ce10a0340c
commit 19bb5eee3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 10 deletions

View file

@ -29,6 +29,6 @@ jobs:
target/ target/
key: ubuntu-test-cargo-${{ hashFiles('**/Cargo.lock') }} key: ubuntu-test-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Lint - name: Lint
run: cargo clippy run: cargo clippy -- --deny warnings
- name: Build test - name: Build test
run: cargo build run: cargo build

View file

@ -2,9 +2,8 @@ use std::time::{self, Duration};
use fake::{Fake, Faker}; use fake::{Fake, Faker};
use gpui::{ use gpui::{
div, impl_actions, AnyElement, ClickEvent, InteractiveElement, IntoElement, ParentElement, div, impl_actions, AnyElement, InteractiveElement, IntoElement, ParentElement, Pixels, Render,
Pixels, Render, SharedString, Styled, Timer, View, ViewContext, VisualContext as _, SharedString, Styled, Timer, View, ViewContext, VisualContext as _, WindowContext,
WindowContext,
}; };
use serde::Deserialize; use serde::Deserialize;
use ui::{ use ui::{
@ -17,7 +16,7 @@ use ui::{
popup_menu::PopupMenuExt, popup_menu::PopupMenuExt,
prelude::FluentBuilder as _, prelude::FluentBuilder as _,
table::{ColFixed, ColSort, Table, TableDelegate, TableEvent}, table::{ColFixed, ColSort, Table, TableDelegate, TableEvent},
v_flex, Selectable, Sizable, Size, v_flex, Selectable, Size,
}; };
#[derive(Clone, PartialEq, Eq, Deserialize)] #[derive(Clone, PartialEq, Eq, Deserialize)]
@ -662,7 +661,7 @@ impl Render for TableStory {
.compact() .compact()
.outline() .outline()
.label(format!("size: {:?}", self.size)) .label(format!("size: {:?}", self.size))
.popup_menu(move |menu, cx| { .popup_menu(move |menu, _| {
menu.menu_with_check( menu.menu_with_check(
"Large", "Large",
size == Size::Large, size == Size::Large,

View file

@ -265,17 +265,17 @@ impl DockArea {
DockPlacement::Left => self DockPlacement::Left => self
.left_dock .left_dock
.as_ref() .as_ref()
.and_then(|dock| Some(dock.read(cx).is_open())) .map(|dock| dock.read(cx).is_open())
.unwrap_or(false), .unwrap_or(false),
DockPlacement::Bottom => self DockPlacement::Bottom => self
.bottom_dock .bottom_dock
.as_ref() .as_ref()
.and_then(|dock| Some(dock.read(cx).is_open())) .map(|dock| dock.read(cx).is_open())
.unwrap_or(false), .unwrap_or(false),
DockPlacement::Right => self DockPlacement::Right => self
.right_dock .right_dock
.as_ref() .as_ref()
.and_then(|dock| Some(dock.read(cx).is_open())) .map(|dock| dock.read(cx).is_open())
.unwrap_or(false), .unwrap_or(false),
} }
} }

View file

@ -334,7 +334,7 @@ where
fn set_selected_col(&mut self, col_ix: usize, cx: &mut ViewContext<Self>) { fn set_selected_col(&mut self, col_ix: usize, cx: &mut ViewContext<Self>) {
self.selection_state = SelectionState::Column; self.selection_state = SelectionState::Column;
self.selected_col = Some(col_ix); self.selected_col = Some(col_ix);
if let Some(col_ix) = self.selected_col { if let Some(_col_ix) = self.selected_col {
// TODO: Fix scroll to selected col, this was not working after fixed col. // TODO: Fix scroll to selected col, this was not working after fixed col.
// if self.col_groups[col_ix].fixed.is_none() { // if self.col_groups[col_ix].fixed.is_none() {
// self.horizontal_scroll_handle.scroll_to_item(col_ix); // self.horizontal_scroll_handle.scroll_to_item(col_ix);