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(-)
@@ -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"
@@ -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};
@@ -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>>;
@@ -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)]
@@ -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();
@@ -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;