Skip to content

Commit

Permalink
upgrade everything and fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
tazz4843 committed Mar 29, 2024
1 parent b655987 commit 69c92f6
Show file tree
Hide file tree
Showing 15 changed files with 708 additions and 586 deletions.
1,247 changes: 686 additions & 561 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ server:
#bind_address: /var/run/nbb
bind_address:
- 0.0.0.0
- 8080
- 4444

# Log filter
#
# This is passed directly to `tracing-subscriber`.
# The `RUST_LOG` environment variable overrides this.
log_filter: "trace"
log_filter: "info"


html:
Expand Down Expand Up @@ -158,7 +158,7 @@ markdown:
#
# Each term must be defined in one paragraph,
# followed by a blank line, and then by the details.
# Details begins with a colon.
# Details begin with a colon.
#
#
# ```md
Expand Down
2 changes: 1 addition & 1 deletion nbb_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ edition = "2021"
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.9"
once_cell = { version = "1.9.0", features = ["parking_lot"] }
once_cell = { version = "1.19.0", features = ["parking_lot"] }
4 changes: 2 additions & 2 deletions nbb_config/src/cfg_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use once_cell::sync::OnceCell;
static APP_CONFIG: OnceCell<GlobalConfig> = OnceCell::new();

#[inline]
pub fn set_config(config: GlobalConfig<'static>) -> Result<(), GlobalConfig> {
APP_CONFIG.set(config)
pub fn set_config(config: GlobalConfig<'static>) -> Result<(), ()> {
APP_CONFIG.set(config).map_err(|_| ())
}

/// Get the global config object.
Expand Down
1 change: 0 additions & 1 deletion nbb_config/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! `nbb_config`
#![feature(once_cell)]
#![deny(missing_docs)]

#[macro_use]
Expand Down
2 changes: 1 addition & 1 deletion nbb_consts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ build = "build.rs"
[dependencies]

[build-dependencies]
built = { version = "0.5", features = ["chrono", "git2", "semver"] }
built = { version = "0.7", features = ["chrono", "git2", "semver"] }

2 changes: 1 addition & 1 deletion nbb_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ nbb_config = { path = "../nbb_config" }
nbb_server = { path = "../nbb_server" }
nbb_consts = { path = "../nbb_consts" }

tokio = { version = "1.24", features = ["full"] }
tokio = { version = "1.37", features = ["full"] }
tracing-subscriber = { version = "0.3", features = ["parking_lot", "time", "env-filter"] }
tracing = "0.1"
10 changes: 5 additions & 5 deletions nbb_markdown/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ edition = "2021"
nbb_config = { path = "../nbb_config" }

tracing = "0.1"
dashmap = "5.1"
comrak = "0.17"
tokio = { version = "1.24", features = ["full"] }
once_cell = { version = "1.9.0", features = ["parking_lot"] }
blake2 = { version = "0.10", features = ["simd_opt"] }
dashmap = "5.5"
comrak = "0.21"
tokio = { version = "1.37", features = ["full"] }
once_cell = { version = "1.19.0", features = ["parking_lot"] }
blake2 = { version = "0.10" }
2 changes: 1 addition & 1 deletion nbb_markdown/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static RENDERER_CACHE: OnceCell<DashMap<PathBuf, String>> = OnceCell::new();
fn check_hash(path: &Path) -> bool {
let fmt_path = path.to_string_lossy();
debug!(path=%fmt_path, "checking hash for {:?}", path);
let mut f = match std::fs::OpenOptions::new().read(true).open(&path) {
let mut f = match std::fs::OpenOptions::new().read(true).open(path) {
Ok(f) => f,
Err(_) => return false,
};
Expand Down
6 changes: 3 additions & 3 deletions nbb_markdown/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ fn load_config() -> ComrakOptions {

let mut options = ComrakOptions::default();

let mut parse_opts = &mut options.parse;
let parse_opts = &mut options.parse;
parse_opts.default_info_string = md_cfg.default_code_language.clone().map(|x| x.to_string());
parse_opts.smart = md_cfg.smart_punctuation;

let mut render_opts = &mut options.render;
let render_opts = &mut options.render;
render_opts.escape = md_cfg.escape_custom_html;
render_opts.github_pre_lang = md_cfg.github_pre_lang;
render_opts.hardbreaks = md_cfg.soft_breaks_to_hard_breaks;
render_opts.unsafe_ = md_cfg.r#unsafe;
render_opts.width = md_cfg.max_line_length as usize;

let mut extension_opts = &mut options.extension;
let extension_opts = &mut options.extension;
extension_opts.autolink = md_ext_cfg.autolink;
extension_opts.description_lists = md_ext_cfg.description_lists;
extension_opts.footnotes = md_ext_cfg.footnotes;
Expand Down
2 changes: 0 additions & 2 deletions nbb_markdown/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(once_cell)]

#[macro_use]
extern crate tracing;

Expand Down
2 changes: 1 addition & 1 deletion nbb_markdown/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn render_markdown(path: &Path) -> String {

crate::cache::get_from_cache(path).map_or_else(
|| {
let md = std::fs::read_to_string(&path).expect("file doesn't exist!");
let md = std::fs::read_to_string(path).expect("file doesn't exist!");
let rendered = comrak::markdown_to_html(&md, cfg);
crate::cache::insert_into_cache(path.to_path_buf(), rendered.clone());
rendered
Expand Down
4 changes: 2 additions & 2 deletions nbb_renderer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ edition = "2021"
nbb_config = { path = "../nbb_config" }
nbb_consts = { path = "../nbb_consts" }

tera = "1.15"
once_cell = { version = "1.9", features = ["parking_lot"] }
tera = "1.19"
once_cell = { version = "1.19", features = ["parking_lot"] }
serde = { version = "1.0", features = ["derive"] }
signal-hook = "0.3"
parking_lot = "0.12"
2 changes: 1 addition & 1 deletion nbb_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ nbb_consts = { path = "../nbb_consts" }

tracing = "0.1"
axum = "0.6"
tokio = { version = "1.24", features = ["full"] }
tokio = { version = "1.37", features = ["full"] }
hyper = "0.14"
tokio-stream = { version = "0.1", features = ["net"] }
tower-http = { version = "0.3", features = ["fs", "trace"] }
Expand Down
2 changes: 1 addition & 1 deletion nbb_server/src/start_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async fn start_server_tcp(addr: &str, port: u16, router: Router) {
}

async fn start_server_uds(path: &str, router: Router) {
let listener = tokio::net::UnixListener::bind(&path).expect("failed to bind to unix socket");
let listener = tokio::net::UnixListener::bind(path).expect("failed to bind to unix socket");
let stream = tokio_stream::wrappers::UnixListenerStream::new(listener);
let acceptor = hyper::server::accept::from_stream(stream);

Expand Down

0 comments on commit 69c92f6

Please sign in to comment.