Add some clippy lints
This commit is contained in:
parent
5b8ad33c60
commit
0b603df139
6 changed files with 13 additions and 21 deletions
11
.drone.yml
11
.drone.yml
|
@ -19,11 +19,16 @@ steps:
|
||||||
- cargo check --all --all-targets
|
- cargo check --all --all-targets
|
||||||
|
|
||||||
- name: cargo clippy
|
- name: cargo clippy
|
||||||
image: rust:1.61-bullseye
|
image: rust:1.65-bullseye
|
||||||
commands:
|
commands:
|
||||||
- rustup component add clippy
|
- rustup component add clippy
|
||||||
- cargo clippy --workspace --tests --all-targets --all-features -- -D warnings -D deprecated -D clippy::perf -D clippy::complexity -D clippy::dbg_macro
|
- cargo clippy --workspace --tests --all-targets --all-features --
|
||||||
- cargo clippy --workspace -- -D clippy::unwrap_used
|
-D warnings -D deprecated -D clippy::perf -D clippy::complexity
|
||||||
|
-D clippy::dbg_macro -D clippy::inefficient_to_string
|
||||||
|
-D clippy::items-after-statements -D clippy::implicit_clone
|
||||||
|
-D clippy::wildcard_imports -D clippy::cast_lossless
|
||||||
|
-D clippy::manual_string_new -D clippy::redundant_closure_for_method_calls
|
||||||
|
- cargo clippy --workspace --all-features -- -D clippy::unwrap_used
|
||||||
|
|
||||||
- name: cargo test
|
- name: cargo test
|
||||||
image: rust:1.61-bullseye
|
image: rust:1.61-bullseye
|
||||||
|
|
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4,7 +4,7 @@ version = 3
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "activitypub_federation"
|
name = "activitypub_federation"
|
||||||
version = "0.3.3"
|
version = "0.3.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitystreams-kinds",
|
"activitystreams-kinds",
|
||||||
"actix-rt",
|
"actix-rt",
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
use rand::{distributions::Alphanumeric, thread_rng, Rng};
|
|
||||||
use url::{ParseError, Url};
|
|
||||||
|
|
||||||
/// Just generate random url as object id. In a real project, you probably want to use
|
|
||||||
/// an url which contains the database id for easy retrieval (or store the random id in db).
|
|
||||||
pub fn generate_object_id(hostname: &str) -> Result<Url, ParseError> {
|
|
||||||
let id: String = thread_rng()
|
|
||||||
.sample_iter(&Alphanumeric)
|
|
||||||
.take(7)
|
|
||||||
.map(char::from)
|
|
||||||
.collect();
|
|
||||||
Url::parse(&format!("http://{}/objects/{}", hostname, id))
|
|
||||||
}
|
|
|
@ -1,10 +1,10 @@
|
||||||
use crate::{error::Error, instance::Instance, lib::generate_object_id, objects::note::MyPost};
|
use crate::{error::Error, instance::Instance, utils::generate_object_id, objects::note::MyPost};
|
||||||
use tracing::log::LevelFilter;
|
use tracing::log::LevelFilter;
|
||||||
|
|
||||||
mod activities;
|
mod activities;
|
||||||
mod error;
|
mod error;
|
||||||
mod instance;
|
mod instance;
|
||||||
mod lib;
|
mod utils;
|
||||||
mod objects;
|
mod objects;
|
||||||
|
|
||||||
#[actix_rt::main]
|
#[actix_rt::main]
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::{
|
||||||
activities::{accept::Accept, create_note::CreateNote, follow::Follow},
|
activities::{accept::Accept, create_note::CreateNote, follow::Follow},
|
||||||
error::Error,
|
error::Error,
|
||||||
instance::InstanceHandle,
|
instance::InstanceHandle,
|
||||||
lib::generate_object_id,
|
utils::generate_object_id,
|
||||||
objects::note::MyPost,
|
objects::note::MyPost,
|
||||||
};
|
};
|
||||||
use activitypub_federation::{
|
use activitypub_federation::{
|
||||||
|
|
|
@ -144,7 +144,7 @@ async fn do_send(
|
||||||
request_builder,
|
request_builder,
|
||||||
task.activity.clone(),
|
task.activity.clone(),
|
||||||
task.public_key.clone(),
|
task.public_key.clone(),
|
||||||
task.private_key.to_owned(),
|
task.private_key.clone(),
|
||||||
task.http_signature_compat,
|
task.http_signature_compat,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
Loading…
Reference in a new issue