mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-15 16:00:38 +08:00
chore: Fix clippy warnings w/ 1.85.1
This commit is contained in:
@@ -51,7 +51,7 @@ pub struct BrowserProps<'a> {
|
||||
search: String,
|
||||
}
|
||||
|
||||
impl<'a> From<&State> for BrowserProps<'a> {
|
||||
impl From<&State> for BrowserProps<'_> {
|
||||
fn from(state: &State) -> Self {
|
||||
let header = match state.mode.repository() {
|
||||
RepositoryMode::Contextual => state.project.name().to_string(),
|
||||
|
||||
@@ -49,7 +49,7 @@ pub struct BrowserProps<'a> {
|
||||
search: String,
|
||||
}
|
||||
|
||||
impl<'a> From<&State> for BrowserProps<'a> {
|
||||
impl From<&State> for BrowserProps<'_> {
|
||||
fn from(state: &State) -> Self {
|
||||
use radicle::issue::State;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ pub struct BrowserProps<'a> {
|
||||
search: String,
|
||||
}
|
||||
|
||||
impl<'a> From<&State> for BrowserProps<'a> {
|
||||
impl From<&State> for BrowserProps<'_> {
|
||||
fn from(state: &State) -> Self {
|
||||
let mut draft = 0;
|
||||
let mut open = 0;
|
||||
|
||||
@@ -244,7 +244,7 @@ pub struct App<'a> {
|
||||
state: Arc<Mutex<AppState>>,
|
||||
}
|
||||
|
||||
impl<'a> App<'a> {
|
||||
impl App<'_> {
|
||||
pub fn new(
|
||||
storage: Storage,
|
||||
review: Review,
|
||||
@@ -318,7 +318,7 @@ impl<'a> App<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> App<'a> {
|
||||
impl App<'_> {
|
||||
fn show_hunk_list(&self, ui: &mut Ui<Message>, frame: &mut Frame) {
|
||||
let hunks = self.hunks.lock().unwrap();
|
||||
let state = self.state.lock().unwrap();
|
||||
@@ -486,7 +486,7 @@ impl<'a> App<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Show<Message> for App<'a> {
|
||||
impl Show<Message> for App<'_> {
|
||||
fn show(&self, ctx: &Context<Message>, frame: &mut Frame) -> Result<(), anyhow::Error> {
|
||||
Window::default().show(ctx, |ui| {
|
||||
let page = {
|
||||
@@ -558,7 +558,7 @@ impl<'a> Show<Message> for App<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> store::Update<Message> for App<'a> {
|
||||
impl store::Update<Message> for App<'_> {
|
||||
type Return = Response;
|
||||
|
||||
fn update(&mut self, message: Message) -> Option<Exit<Self::Return>> {
|
||||
@@ -677,7 +677,7 @@ mod test {
|
||||
use super::*;
|
||||
use crate::test;
|
||||
|
||||
impl<'a> App<'a> {
|
||||
impl App<'_> {
|
||||
pub fn hunks(&self) -> Vec<StatefulHunkItem> {
|
||||
self.hunks.lock().unwrap().clone()
|
||||
}
|
||||
@@ -703,10 +703,10 @@ mod test {
|
||||
) -> Result<App<'a>> {
|
||||
let draft_store = DraftStore::new(&node.repo.repo, *node.signer.public_key());
|
||||
let mut drafts = Cache::no_cache(&draft_store)?;
|
||||
let mut draft = drafts.get_mut(&patch.id())?;
|
||||
let mut draft = drafts.get_mut(patch.id())?;
|
||||
|
||||
let (_, revision) = patch.latest();
|
||||
let (_, review) = draft_review(&node, &mut draft, revision)?;
|
||||
let (_, review) = draft_review(node, &mut draft, revision)?;
|
||||
|
||||
let hunks = ReviewBuilder::new(&node.repo).hunks(revision)?;
|
||||
|
||||
@@ -835,7 +835,7 @@ mod test {
|
||||
app.update(Message::Accept);
|
||||
|
||||
let state = app.state.lock().unwrap();
|
||||
let state = &state.hunk_states().get(0).unwrap();
|
||||
let state = &state.hunk_states().first().unwrap();
|
||||
|
||||
assert_eq!(**state, HunkState::Accepted);
|
||||
|
||||
|
||||
+7
-7
@@ -118,7 +118,7 @@ pub mod setup {
|
||||
}
|
||||
|
||||
pub mod fixtures {
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::path::Path;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
@@ -301,14 +301,14 @@ fn main() {
|
||||
/// 8 7
|
||||
/// 9 8 // This is the main function.
|
||||
/// 10 9 fn main() {
|
||||
pub fn simple_modified_hunk_diff(path: &PathBuf, commit: Oid) -> Result<HunkDiff> {
|
||||
pub fn simple_modified_hunk_diff(path: &Path, commit: Oid) -> Result<HunkDiff> {
|
||||
let diff = DiffFile {
|
||||
oid: commit,
|
||||
mode: diff::FileMode::Blob,
|
||||
};
|
||||
|
||||
Ok(HunkDiff::Modified {
|
||||
path: path.clone(),
|
||||
path: path.to_path_buf(),
|
||||
header: FileHeader::Modified {
|
||||
path: path.to_path_buf(),
|
||||
old: diff.clone(),
|
||||
@@ -368,14 +368,14 @@ fn main() {
|
||||
/// 15 13
|
||||
/// 16 14 use super::ui::{IdSelect, OperationSelect};
|
||||
/// 17 15 use super::{IssueOperation, Message};
|
||||
pub fn complex_modified_hunk_diff(path: &PathBuf, commit: Oid) -> Result<HunkDiff> {
|
||||
pub fn complex_modified_hunk_diff(path: &Path, commit: Oid) -> Result<HunkDiff> {
|
||||
let diff = DiffFile {
|
||||
oid: commit,
|
||||
mode: diff::FileMode::Blob,
|
||||
};
|
||||
|
||||
Ok(HunkDiff::Modified {
|
||||
path: path.clone(),
|
||||
path: path.to_path_buf(),
|
||||
header: FileHeader::Modified {
|
||||
path: path.to_path_buf(),
|
||||
old: diff.clone(),
|
||||
@@ -449,14 +449,14 @@ fn main() {
|
||||
|
||||
/// @@ -1,1 +0,0 @@
|
||||
/// - TBD
|
||||
pub fn deleted_hunk_diff(path: &PathBuf, commit: Oid) -> Result<HunkDiff> {
|
||||
pub fn deleted_hunk_diff(path: &Path, commit: Oid) -> Result<HunkDiff> {
|
||||
let diff = DiffFile {
|
||||
oid: commit,
|
||||
mode: diff::FileMode::Blob,
|
||||
};
|
||||
|
||||
Ok(HunkDiff::Deleted {
|
||||
path: path.clone(),
|
||||
path: path.to_path_buf(),
|
||||
header: FileHeader::Deleted {
|
||||
path: path.to_path_buf(),
|
||||
old: diff.clone(),
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ impl<'a, R, const W: usize> Browser<'a, R, W> {
|
||||
|
||||
/// TODO(erikli): Implement `show` that returns an `InnerResponse` such that it can
|
||||
/// used like a group.
|
||||
impl<'a, R, const W: usize> Widget for Browser<'a, R, W>
|
||||
impl<R, const W: usize> Widget for Browser<'_, R, W>
|
||||
where
|
||||
R: ToRow<W> + Clone,
|
||||
{
|
||||
|
||||
+4
-4
@@ -1037,7 +1037,7 @@ impl ToTree<String> for CommentItem {
|
||||
|
||||
pub struct TermLine(terminal::Line);
|
||||
|
||||
impl<'a> From<TermLine> for Line<'a> {
|
||||
impl From<TermLine> for Line<'_> {
|
||||
fn from(val: TermLine) -> Self {
|
||||
Line::raw(val.0.to_string())
|
||||
}
|
||||
@@ -1252,7 +1252,7 @@ pub struct HunkItem<'a> {
|
||||
pub comments: HunkComments,
|
||||
}
|
||||
|
||||
impl<'a> From<(&Repository, &Review, &HunkDiff)> for HunkItem<'a> {
|
||||
impl From<(&Repository, &Review, &HunkDiff)> for HunkItem<'_> {
|
||||
fn from(value: (&Repository, &Review, &HunkDiff)) -> Self {
|
||||
let (repo, review, item) = value;
|
||||
let hi = Highlighter::default();
|
||||
@@ -1299,7 +1299,7 @@ impl<'a> From<(&Repository, &Review, &HunkDiff)> for HunkItem<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ToRow<3> for StatefulHunkItem<'a> {
|
||||
impl ToRow<3> for StatefulHunkItem<'_> {
|
||||
fn to_row(&self) -> [Cell; 3] {
|
||||
let build_stats_spans = |stats: &DiffStats| -> Vec<Span<'_>> {
|
||||
let mut cell = vec![];
|
||||
@@ -1736,7 +1736,7 @@ impl<'a> HunkItem<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Debug for HunkItem<'a> {
|
||||
impl Debug for HunkItem<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("HunkItem")
|
||||
.field("inner", &self.diff)
|
||||
|
||||
+16
-18
@@ -255,7 +255,7 @@ impl<'a> Label<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Widget for Label<'a> {
|
||||
impl Widget for Label<'_> {
|
||||
fn ui<M>(self, ui: &mut Ui<M>, frame: &mut Frame) -> Response {
|
||||
let (area, _) = ui.next_area().unwrap_or_default();
|
||||
frame.render_widget(self.content, area);
|
||||
@@ -380,7 +380,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, R, const W: usize> Widget for Table<'a, R, W>
|
||||
impl<R, const W: usize> Widget for Table<'_, R, W>
|
||||
where
|
||||
R: ToRow<W> + Clone,
|
||||
{
|
||||
@@ -515,16 +515,14 @@ where
|
||||
|
||||
frame.render_stateful_widget(scroller, scroller_area, &mut state);
|
||||
}
|
||||
} else {
|
||||
if let Some(message) = self.empty_message {
|
||||
let center = layout::centered_rect(area, 50, 10);
|
||||
let hint = Text::from(span::default(&message))
|
||||
.centered()
|
||||
.light_magenta()
|
||||
.dim();
|
||||
} else if let Some(message) = self.empty_message {
|
||||
let center = layout::centered_rect(area, 50, 10);
|
||||
let hint = Text::from(span::default(&message))
|
||||
.centered()
|
||||
.light_magenta()
|
||||
.dim();
|
||||
|
||||
frame.render_widget(hint, center);
|
||||
}
|
||||
frame.render_widget(hint, center);
|
||||
}
|
||||
|
||||
*self.selected = state.selected();
|
||||
@@ -565,7 +563,7 @@ impl<'a, R, const W: usize> HeaderedTable<'a, R, W> {
|
||||
|
||||
/// TODO(erikli): Implement `show` that returns an `InnerResponse` such that it can
|
||||
/// used like a group.
|
||||
impl<'a, R, const W: usize> Widget for HeaderedTable<'a, R, W>
|
||||
impl<R, const W: usize> Widget for HeaderedTable<'_, R, W>
|
||||
where
|
||||
R: ToRow<W> + Clone,
|
||||
{
|
||||
@@ -608,7 +606,7 @@ impl<'a> Columns<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Widget for Columns<'a> {
|
||||
impl Widget for Columns<'_> {
|
||||
fn ui<M>(self, ui: &mut Ui<M>, frame: &mut Frame) -> Response
|
||||
where
|
||||
M: Clone,
|
||||
@@ -667,7 +665,7 @@ impl<'a> Bar<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Widget for Bar<'a> {
|
||||
impl Widget for Bar<'_> {
|
||||
fn ui<M>(self, ui: &mut Ui<M>, frame: &mut Frame) -> Response
|
||||
where
|
||||
M: Clone,
|
||||
@@ -773,7 +771,7 @@ impl<'a> TextView<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Widget for TextView<'a> {
|
||||
impl Widget for TextView<'_> {
|
||||
fn ui<M>(self, ui: &mut Ui<M>, frame: &mut Frame) -> Response
|
||||
where
|
||||
M: Clone,
|
||||
@@ -893,7 +891,7 @@ impl<'a> CenteredTextView<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Widget for CenteredTextView<'a> {
|
||||
impl Widget for CenteredTextView<'_> {
|
||||
fn ui<M>(self, ui: &mut Ui<M>, frame: &mut Frame) -> Response {
|
||||
let (area, area_focus) = ui.next_area().unwrap_or_default();
|
||||
|
||||
@@ -1024,7 +1022,7 @@ impl<'a> TextEdit<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TextEdit<'a> {
|
||||
impl TextEdit<'_> {
|
||||
pub fn show<M>(self, ui: &mut Ui<M>, frame: &mut Frame) -> TextEditOutput
|
||||
where
|
||||
M: Clone,
|
||||
@@ -1130,7 +1128,7 @@ impl<'a> TextEdit<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Widget for TextEdit<'a> {
|
||||
impl Widget for TextEdit<'_> {
|
||||
fn ui<M>(self, ui: &mut Ui<M>, frame: &mut Frame) -> Response
|
||||
where
|
||||
M: Clone,
|
||||
|
||||
+1
-1
@@ -245,7 +245,7 @@ pub trait View {
|
||||
/// define the data, configuration etc. of a widget. They are updated by the framework
|
||||
/// taking the properties built by the `on_update` callback. The `on_event` callback is
|
||||
/// used to emit application messages whenever a widget receives an event.
|
||||
|
||||
///
|
||||
/// The main idea is to build widgets that handle their specific events already,
|
||||
/// and that are updated with the properties built by the `on_update` callback.
|
||||
/// Custom logic is added by setting the `on_event` callback. E.g. the `Table` widget
|
||||
|
||||
@@ -44,7 +44,7 @@ impl<'a> HeaderProps<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Default for HeaderProps<'a> {
|
||||
impl Default for HeaderProps<'_> {
|
||||
fn default() -> Self {
|
||||
let theme = Theme::default();
|
||||
|
||||
@@ -71,7 +71,7 @@ impl<S, M> Default for Header<S, M> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, S, M> View for Header<S, M> {
|
||||
impl<S, M> View for Header<S, M> {
|
||||
type Message = M;
|
||||
type State = S;
|
||||
|
||||
@@ -169,7 +169,7 @@ impl<'a> FooterProps<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Default for FooterProps<'a> {
|
||||
impl Default for FooterProps<'_> {
|
||||
fn default() -> Self {
|
||||
let theme = Theme::default();
|
||||
|
||||
@@ -220,7 +220,7 @@ impl<'a, S, M> Footer<S, M> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a: 'static, S, M> View for Footer<S, M> {
|
||||
impl<S, M> View for Footer<S, M> {
|
||||
type Message = M;
|
||||
type State = S;
|
||||
|
||||
|
||||
@@ -335,7 +335,7 @@ pub struct TextAreaProps<'a> {
|
||||
dim: bool,
|
||||
}
|
||||
|
||||
impl<'a> Default for TextAreaProps<'a> {
|
||||
impl Default for TextAreaProps<'_> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
content: String::new().into(),
|
||||
@@ -392,7 +392,7 @@ pub struct TextArea<'a, S, M> {
|
||||
area: (u16, u16),
|
||||
}
|
||||
|
||||
impl<'a, S, M> Default for TextArea<'a, S, M> {
|
||||
impl<S, M> Default for TextArea<'_, S, M> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
phantom: PhantomData,
|
||||
@@ -402,7 +402,7 @@ impl<'a, S, M> Default for TextArea<'a, S, M> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, S, M> View for TextArea<'a, S, M> {
|
||||
impl<S, M> View for TextArea<'_, S, M> {
|
||||
type State = S;
|
||||
type Message = M;
|
||||
|
||||
@@ -663,7 +663,7 @@ impl<'a> TextViewProps<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Default for TextViewProps<'a> {
|
||||
impl Default for TextViewProps<'_> {
|
||||
fn default() -> Self {
|
||||
let theme = Theme::default();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ where
|
||||
pub dim: bool,
|
||||
}
|
||||
|
||||
impl<'a, R, const W: usize> Default for TableProps<'a, R, W>
|
||||
impl<R, const W: usize> Default for TableProps<'_, R, W>
|
||||
where
|
||||
R: ToRow<W>,
|
||||
{
|
||||
|
||||
@@ -54,9 +54,8 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, S, M, Id> View for Window<S, M, Id>
|
||||
impl<S, M, Id> View for Window<S, M, Id>
|
||||
where
|
||||
'a: 'static,
|
||||
S: 'static,
|
||||
M: 'static,
|
||||
Id: Clone + Hash + Eq + PartialEq + 'static,
|
||||
|
||||
Reference in New Issue
Block a user