🏡 index : ~doyle/bin.git

author Jordan Doyle <jordan@doyle.la> 2025-05-25 16:57:48.0 +08:00:00
committer Jordan Doyle <jordan@doyle.la> 2025-05-25 16:57:48.0 +08:00:00
commit
914c2d286fb7431e2bbabc6060957a80e479edfe [patch]
tree
6e3ce70be5660e08504a4a99aa917e4bb605d863
parent
fcefabedef4df822e55420fe579d41faa1112c16
download
914c2d286fb7431e2bbabc6060957a80e479edfe.tar.gz

Move to Rust 2024 Edition



Diff

 Cargo.toml    |  2 +-
 src/errors.rs |  2 +-
 src/io.rs     |  2 +-
 src/main.rs   | 14 ++++++++++----
 src/params.rs |  2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index de37dd4..29d524b 100644
--- a/Cargo.toml
+++ a/Cargo.toml
@@ -5,7 +5,7 @@
repository = "https://github.com/w4/bin"
license = "WTFPL OR 0BSD"
authors = ["Jordan Doyle <jordan@doyle.la>"]
edition = "2021"
edition = "2024"

[dependencies]
argh = "0.1"
diff --git a/src/errors.rs b/src/errors.rs
index 9892649..4a8da09 100644
--- a/src/errors.rs
+++ a/src/errors.rs
@@ -1,4 +1,4 @@
use actix_web::{body::BoxBody, http::header, http::StatusCode, web, HttpResponse, ResponseError};
use actix_web::{HttpResponse, ResponseError, body::BoxBody, http::StatusCode, http::header, web};

use std::fmt::{Formatter, Write};

diff --git a/src/io.rs b/src/io.rs
index 30ad195..d2a33aa 100644
--- a/src/io.rs
+++ a/src/io.rs
@@ -1,7 +1,7 @@
use actix_web::web::Bytes;
use linked_hash_map::LinkedHashMap;
use parking_lot::RwLock;
use rand::{distr::Alphanumeric, rng, Rng};
use rand::{Rng, distr::Alphanumeric, rng};
use std::{cell::RefCell, sync::LazyLock};

pub type PasteStore = RwLock<LinkedHashMap<String, Bytes>>;
diff --git a/src/main.rs b/src/main.rs
index ab70539..0a9c0b5 100644
--- a/src/main.rs
+++ a/src/main.rs
@@ -9,14 +9,14 @@
use crate::{
    errors::{InternalServerError, NotFound},
    highlight::highlight,
    io::{generate_id, get_paste, store_paste, PasteStore},
    io::{PasteStore, generate_id, get_paste, store_paste},
    params::{HostHeader, IsPlaintextRequest},
};

use actix_web::{
    App, Error, HttpRequest, HttpResponse, HttpServer, Responder,
    http::header,
    web::{self, Bytes, Data, FormConfig, PayloadConfig},
    App, Error, HttpRequest, HttpResponse, HttpServer, Responder,
};
use askama::Template;
use log::{error, info};
@@ -24,7 +24,7 @@
    net::{IpAddr, Ipv4Addr, SocketAddr},
    sync::LazyLock,
};
use syntect::html::{css_for_theme_with_class_style, ClassStyle};
use syntect::html::{ClassStyle, css_for_theme_with_class_style};

#[derive(argh::FromArgs, Clone)]
/// a pastebin.

@@ -45,10 +45,10 @@

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    if std::env::var_os("RUST_LOG").is_none() {
        std::env::set_var("RUST_LOG", "INFO");
    }
    pretty_env_logger::init();
    pretty_env_logger::formatted_builder()
        .filter_level(log::LevelFilter::Info)
        .parse_default_env()
        .init();

    let args: BinArgs = argh::from_env();

diff --git a/src/params.rs b/src/params.rs
index fc8b952..ab82468 100644
--- a/src/params.rs
+++ a/src/params.rs
@@ -1,9 +1,9 @@
use std::ops::Deref;

use actix_web::{
    FromRequest, HttpMessage, HttpRequest,
    dev::Payload,
    http::header::{self, HeaderValue},
    FromRequest, HttpMessage, HttpRequest,
};
use futures::future::ok;