mirror of
https://seed.radicle.dev/rad:z4D5UCArafTzTQpDZNQRuqswh3ury.git
synced 2026-10-18 19:10:45 +08:00
Fix clippy lints for Rust 1.90
This commit is contained in:
@@ -12,10 +12,10 @@ use radicle_types::domain::patch::service::Service;
|
||||
use radicle_types::domain::patch::traits::PatchService;
|
||||
use radicle_types::error::Error;
|
||||
use radicle_types::outbound::sqlite::Sqlite;
|
||||
use radicle_types::traits::Profile;
|
||||
use radicle_types::traits::cobs::Cobs;
|
||||
use radicle_types::traits::patch::Patches;
|
||||
use radicle_types::traits::patch::PatchesMut;
|
||||
use radicle_types::traits::Profile;
|
||||
|
||||
use crate::AppState;
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ use radicle::node;
|
||||
use radicle::patch::cache::Patches;
|
||||
use radicle::storage::{ReadRepository, ReadStorage};
|
||||
|
||||
use radicle_types::AppState;
|
||||
use radicle_types::domain::inbox::models::notification::{self, RepoGroupByItem};
|
||||
use radicle_types::domain::inbox::service::Service;
|
||||
use radicle_types::domain::inbox::traits::InboxService;
|
||||
use radicle_types::error::Error;
|
||||
use radicle_types::outbound::sqlite::Sqlite;
|
||||
use radicle_types::AppState;
|
||||
|
||||
#[tauri::command]
|
||||
pub fn list_notifications(
|
||||
@@ -78,8 +78,7 @@ pub fn list_notifications(
|
||||
.into_iter()
|
||||
.take(take)
|
||||
.map(|(qualified, n)| {
|
||||
let items = n
|
||||
.into_iter()
|
||||
n.into_iter()
|
||||
.filter_map(|s| {
|
||||
let update: notification::RefUpdate =
|
||||
(qualified.clone().into_refstring(), s.new, s.old).into();
|
||||
@@ -163,9 +162,7 @@ pub fn list_notifications(
|
||||
_ => None,
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
items
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.filter(|v| !v.is_empty())
|
||||
.collect::<RepoGroupByItem>();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use tauri::{AppHandle, Emitter, Manager};
|
||||
|
||||
use radicle::cob::cache::COBS_DB_FILE;
|
||||
use radicle::node::{Handle, Node, NOTIFICATIONS_DB_FILE};
|
||||
use radicle::node::{Handle, NOTIFICATIONS_DB_FILE, Node};
|
||||
|
||||
use radicle_types::config::{Config, Version};
|
||||
use radicle_types::error::Error;
|
||||
use radicle_types::traits::Profile;
|
||||
use radicle_types::{domain, AppState};
|
||||
use radicle_types::{AppState, domain};
|
||||
|
||||
#[tauri::command]
|
||||
pub(crate) fn version(app: AppHandle) -> Result<Version, Error> {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use serde_json as json;
|
||||
use thiserror::Error;
|
||||
|
||||
use radicle::git::raw as git2;
|
||||
use radicle::git::Oid;
|
||||
use radicle::git::raw as git2;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
#[error("failed to construct stream: {err}")]
|
||||
|
||||
@@ -15,8 +15,8 @@ use radicle::storage::git::Repository;
|
||||
use crate::cobs::Author;
|
||||
use crate::domain::inbox::models::notification::ActionWithAuthor;
|
||||
|
||||
use super::error;
|
||||
use super::CobRange;
|
||||
use super::error;
|
||||
|
||||
/// A `Walk` specifies a range to construct a [`WalkIter`].
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -159,7 +159,7 @@ impl<'a, A> ActionsIter<'a, A> {
|
||||
return Err(error::Actions::ManifestPath {
|
||||
oid: tree.id().into(),
|
||||
err,
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
let object = entry
|
||||
|
||||
@@ -2,8 +2,8 @@ use radicle::crypto::PublicKey;
|
||||
use serde::Serialize;
|
||||
use ts_rs::TS;
|
||||
|
||||
use radicle::node::config::DefaultSeedingPolicy;
|
||||
use radicle::node::Alias;
|
||||
use radicle::node::config::DefaultSeedingPolicy;
|
||||
|
||||
/// Service configuration.
|
||||
#[derive(Debug, TS, Serialize, PartialEq)]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use traits::Profile;
|
||||
use traits::cobs::Cobs;
|
||||
use traits::issue::{Issues, IssuesMut};
|
||||
use traits::job::Jobs;
|
||||
use traits::patch::{Patches, PatchesMut};
|
||||
use traits::repo::Repo;
|
||||
use traits::thread::Thread;
|
||||
use traits::Profile;
|
||||
|
||||
pub mod cobs;
|
||||
pub mod config;
|
||||
|
||||
@@ -186,11 +186,11 @@ impl InboxStorage for Sqlite {
|
||||
|
||||
let mut stmt = self.db.prepare(&query)?;
|
||||
|
||||
if let Some(repos) = ¶ms.repos {
|
||||
if !repos.is_empty() {
|
||||
for (i, repo) in repos.iter().enumerate() {
|
||||
stmt.bind((i + 1, repo))?;
|
||||
}
|
||||
if let Some(repos) = ¶ms.repos
|
||||
&& !repos.is_empty()
|
||||
{
|
||||
for (i, repo) in repos.iter().enumerate() {
|
||||
stmt.bind((i + 1, repo))?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,10 +218,10 @@ impl InboxStorage for Sqlite {
|
||||
current_group.push((reference.to_owned(), items));
|
||||
}
|
||||
|
||||
if let Some(repo) = current_repo {
|
||||
if !current_group.is_empty() {
|
||||
result.push((repo, current_group));
|
||||
}
|
||||
if let Some(repo) = current_repo
|
||||
&& !current_group.is_empty()
|
||||
{
|
||||
result.push((repo, current_group));
|
||||
}
|
||||
|
||||
Ok(result)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use base64::{prelude::BASE64_STANDARD, Engine};
|
||||
use base64::{Engine, prelude::BASE64_STANDARD};
|
||||
use radicle::git::Oid;
|
||||
use radicle_surf as surf;
|
||||
use serde::Serialize;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use std::path::Path;
|
||||
|
||||
use radicle::Storage;
|
||||
use radicle::cob::migrate;
|
||||
use radicle::crypto::ssh::Keystore;
|
||||
use radicle::crypto::{KeyPair, Seed};
|
||||
use radicle::node::{Features, Timestamp, UserAgent};
|
||||
use radicle::profile::Home;
|
||||
use radicle::Storage;
|
||||
use radicle::{node, profile};
|
||||
|
||||
pub const TIMESTAMP: u64 = 1671125284;
|
||||
|
||||
@@ -35,12 +35,12 @@ pub trait Profile {
|
||||
mod test {
|
||||
use std::str::FromStr;
|
||||
|
||||
use radicle::crypto::test::signer::MockSigner;
|
||||
use radicle::crypto::Signer;
|
||||
use radicle::node::{config, Alias};
|
||||
use radicle::crypto::test::signer::MockSigner;
|
||||
use radicle::node::{Alias, config};
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::{test, AppState, Profile};
|
||||
use crate::{AppState, Profile, test};
|
||||
|
||||
#[test]
|
||||
fn config() {
|
||||
|
||||
@@ -4,7 +4,7 @@ use radicle::cob::Title;
|
||||
use radicle::issue::cache::Issues as _;
|
||||
use radicle::node::Handle;
|
||||
use radicle::storage::ReadStorage;
|
||||
use radicle::{git, identity, Node};
|
||||
use radicle::{Node, git, identity};
|
||||
|
||||
use crate::cobs;
|
||||
use crate::error::Error;
|
||||
@@ -116,10 +116,10 @@ pub trait IssuesMut: Profile {
|
||||
new.embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
|
||||
)?;
|
||||
|
||||
if opts.announce() {
|
||||
if let Err(e) = node.announce_refs_for(rid, [profile.public_key]) {
|
||||
log::error!("Not able to announce changes: {}", e)
|
||||
}
|
||||
if opts.announce()
|
||||
&& let Err(e) = node.announce_refs_for(rid, [profile.public_key])
|
||||
{
|
||||
log::error!("Not able to announce changes: {}", e)
|
||||
}
|
||||
|
||||
Ok::<_, Error>(cobs::issue::Issue::new(issue.id(), &issue, &aliases))
|
||||
@@ -183,10 +183,10 @@ pub trait IssuesMut: Profile {
|
||||
}
|
||||
}
|
||||
|
||||
if opts.announce() {
|
||||
if let Err(e) = node.announce_refs_for(rid, [profile.public_key]) {
|
||||
log::error!("Not able to announce changes: {}", e)
|
||||
}
|
||||
if opts.announce()
|
||||
&& let Err(e) = node.announce_refs_for(rid, [profile.public_key])
|
||||
{
|
||||
log::error!("Not able to announce changes: {}", e)
|
||||
}
|
||||
|
||||
Ok::<_, Error>(cobs::issue::Issue::new(issue.id(), &issue, &aliases))
|
||||
|
||||
@@ -4,7 +4,7 @@ use radicle::cob::Title;
|
||||
use radicle::node::Handle;
|
||||
use radicle::patch::cache::Patches as _;
|
||||
use radicle::storage::ReadStorage;
|
||||
use radicle::{cob, git, identity, Node};
|
||||
use radicle::{Node, cob, git, identity};
|
||||
|
||||
use crate::cobs;
|
||||
use crate::domain::patch::models;
|
||||
@@ -270,10 +270,10 @@ pub trait PatchesMut: Profile {
|
||||
}
|
||||
}
|
||||
|
||||
if opts.announce() {
|
||||
if let Err(e) = node.announce_refs_for(rid, [profile.public_key]) {
|
||||
log::error!("Not able to announce changes: {}", e)
|
||||
}
|
||||
if opts.announce()
|
||||
&& let Err(e) = node.announce_refs_for(rid, [profile.public_key])
|
||||
{
|
||||
log::error!("Not able to announce changes: {}", e)
|
||||
}
|
||||
|
||||
Ok::<_, Error>(models::patch::Patch::new(*patch.id(), &patch, &aliases))
|
||||
|
||||
@@ -3,7 +3,7 @@ use radicle::git::Oid;
|
||||
use radicle_surf as surf;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use radicle::identity::{doc, Doc, DocAt};
|
||||
use radicle::identity::{Doc, DocAt, doc};
|
||||
use radicle::issue::cache::Issues as _;
|
||||
use radicle::node::routing::Store;
|
||||
use radicle::patch::cache::Patches as _;
|
||||
@@ -17,7 +17,7 @@ use crate::diff::Diff;
|
||||
use crate::error::Error;
|
||||
use crate::repo;
|
||||
use crate::source;
|
||||
use crate::syntax::{highlighter, ToPretty};
|
||||
use crate::syntax::{ToPretty, highlighter};
|
||||
use crate::traits::Profile;
|
||||
|
||||
pub const MAX_BLOB_SIZE: usize = 10_485_760;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use std::fs;
|
||||
|
||||
use radicle::Node;
|
||||
use radicle::cob;
|
||||
use radicle::git;
|
||||
use radicle::identity;
|
||||
use radicle::node::Handle;
|
||||
use radicle::storage::ReadRepository;
|
||||
use radicle::storage::ReadStorage;
|
||||
use radicle::Node;
|
||||
|
||||
use crate::cobs;
|
||||
use crate::error::Error;
|
||||
@@ -115,10 +115,10 @@ pub trait Thread: Profile {
|
||||
n.embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
|
||||
)?;
|
||||
|
||||
if opts.announce() {
|
||||
if let Err(e) = node.announce_refs_for(rid, [profile.public_key]) {
|
||||
log::error!("Not able to announce changes: {}", e)
|
||||
}
|
||||
if opts.announce()
|
||||
&& let Err(e) = node.announce_refs_for(rid, [profile.public_key])
|
||||
{
|
||||
log::error!("Not able to announce changes: {}", e)
|
||||
}
|
||||
|
||||
Ok(cobs::thread::Comment::<cobs::Never>::new(
|
||||
@@ -157,10 +157,10 @@ pub trait Thread: Profile {
|
||||
n.embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
|
||||
)?;
|
||||
|
||||
if opts.announce() {
|
||||
if let Err(e) = node.announce_refs_for(rid, [profile.public_key]) {
|
||||
log::error!("Not able to announce changes: {}", e)
|
||||
}
|
||||
if opts.announce()
|
||||
&& let Err(e) = node.announce_refs_for(rid, [profile.public_key])
|
||||
{
|
||||
log::error!("Not able to announce changes: {}", e)
|
||||
}
|
||||
|
||||
Ok(cobs::thread::Comment::<cobs::thread::CodeLocation>::new(
|
||||
|
||||
@@ -2,20 +2,20 @@ use std::ops::Deref;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use axum::Router;
|
||||
use axum::extract::State;
|
||||
use axum::response::{IntoResponse, Json};
|
||||
use axum::routing::post;
|
||||
use axum::Router;
|
||||
use hyper::header::CONTENT_TYPE;
|
||||
use hyper::Method;
|
||||
use hyper::header::CONTENT_TYPE;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tower_http::cors::{self, CorsLayer};
|
||||
|
||||
use radicle::{git, identity};
|
||||
use radicle_types as types;
|
||||
use radicle_types::cobs::CobOptions;
|
||||
use radicle_types::cobs::issue;
|
||||
use radicle_types::cobs::issue::NewIssue;
|
||||
use radicle_types::cobs::CobOptions;
|
||||
use radicle_types::cobs::{self, FromRadicleAction};
|
||||
use radicle_types::config::Version;
|
||||
use radicle_types::domain::patch::models;
|
||||
@@ -23,13 +23,13 @@ use radicle_types::domain::patch::service::Service;
|
||||
use radicle_types::domain::patch::traits::PatchService;
|
||||
use radicle_types::error::Error;
|
||||
use radicle_types::outbound::sqlite::Sqlite;
|
||||
use radicle_types::traits::Profile;
|
||||
use radicle_types::traits::cobs::Cobs;
|
||||
use radicle_types::traits::issue::{Issues, IssuesMut};
|
||||
use radicle_types::traits::job::Jobs;
|
||||
use radicle_types::traits::patch::{Patches, PatchesMut};
|
||||
use radicle_types::traits::repo::{Repo, Show};
|
||||
use radicle_types::traits::thread::Thread;
|
||||
use radicle_types::traits::Profile;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Context {
|
||||
@@ -526,20 +526,20 @@ async fn patches_handler(
|
||||
.collect::<Vec<_>>(),
|
||||
};
|
||||
|
||||
if let Some(t) = take {
|
||||
if t < 0 {
|
||||
// Return all patches
|
||||
let content = patches
|
||||
.into_iter()
|
||||
.map(|(id, patch)| models::patch::Patch::new(id, &patch, &aliases))
|
||||
.collect::<Vec<_>>();
|
||||
if let Some(t) = take
|
||||
&& t < 0
|
||||
{
|
||||
// Return all patches
|
||||
let content = patches
|
||||
.into_iter()
|
||||
.map(|(id, patch)| models::patch::Patch::new(id, &patch, &aliases))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
return Ok::<_, Error>(Json(cobs::PaginatedQuery {
|
||||
cursor: 0,
|
||||
more: false,
|
||||
content,
|
||||
}));
|
||||
}
|
||||
return Ok::<_, Error>(Json(cobs::PaginatedQuery {
|
||||
cursor: 0,
|
||||
more: false,
|
||||
content,
|
||||
}));
|
||||
}
|
||||
|
||||
let take = take.unwrap_or(20) as usize;
|
||||
|
||||
@@ -4,8 +4,8 @@ use std::sync::Arc;
|
||||
use axum::Router;
|
||||
use tokio::net::TcpListener;
|
||||
|
||||
use radicle::cob::cache::COBS_DB_FILE;
|
||||
use radicle::Profile;
|
||||
use radicle::cob::cache::COBS_DB_FILE;
|
||||
|
||||
use radicle_types::domain::patch::service::Service as PatchService;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user