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/
key: ubuntu-test-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Lint
run: cargo clippy
run: cargo clippy -- --deny warnings
- name: Build test
run: cargo build

View file

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

View file

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

View file

@ -334,7 +334,7 @@ where
fn set_selected_col(&mut self, col_ix: usize, cx: &mut ViewContext<Self>) {
self.selection_state = SelectionState::Column;
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.
// if self.col_groups[col_ix].fixed.is_none() {
// self.horizontal_scroll_handle.scroll_to_item(col_ix);