Skip to content

Commit

Permalink
bump Rust toolchain to 1.81, fix clippy warnings, add `azalia-proc-ma…
Browse files Browse the repository at this point in the history
…cros` crate
  • Loading branch information
auguwu committed Sep 18, 2024
1 parent a976dcd commit 6e0eb27
Show file tree
Hide file tree
Showing 11 changed files with 252 additions and 185 deletions.
277 changes: 105 additions & 172 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ homepage = "https://cargo.noelware.cloud"
license = "MIT"
publish = ["noelware"]
repository = "https://github.com/Noelware/core-rs"
rust-version = "1.74"
rust-version = "1.77"
3 changes: 3 additions & 0 deletions crates/azalia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ license.workspace = true
repository.workspace = true
rust-version.workspace = true

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(noeldoc)'] }

[features]
regex = ["dep:regex"]
lazy = ["dep:once_cell"]
Expand Down
2 changes: 1 addition & 1 deletion crates/log/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ log = ["dep:tracing-log"]
[dependencies]
cfg-if = "1.0.0"
chrono = { version = "0.4.38", optional = true }
owo-colors = { version = "5.0.0", optional = true, features = [
owo-colors = { version = "4.1.0", optional = true, features = [
"supports-colors",
] }
serde_json = "1.0.116"
Expand Down
36 changes: 36 additions & 0 deletions crates/proc-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 🐻‍❄️🪚 Azalia: Family of crates that implement common Rust code
# Copyright (c) 2024 Noelware, LLC. <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

[package]
name = "azalia-proc-macros"
description = "🐻‍❄️🪚 Helper functions and macros to help aid proc-macro development"
version.workspace = true
authors.workspace = true
edition.workspace = true
homepage.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true

[dependencies]
proc-macro2 = "1.0.86"
quote = "1.0.37"
syn = "2.0.77"
22 changes: 22 additions & 0 deletions crates/proc-macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 🐻‍❄️🪚 Azalia: Family of crates that implement common Rust code
// Copyright (c) 2024 Noelware, LLC. <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

mod macros;
73 changes: 73 additions & 0 deletions crates/proc-macros/src/macros.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// 🐻‍❄️🪚 Azalia: Family of crates that implement common Rust code
// Copyright (c) 2024 Noelware, LLC. <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

/// Construct a identifier with a given input.
///
/// It is recommended to use the `ident` path as Rust will always make
/// this as a valid identifier.
#[macro_export]
macro_rules! ident {
($ident:ident) => {
::proc_macro2::Ident::new(stringify!($ident), ::proc_macro2::Span::call_site())
};

($ident:literal) => {
::proc_macro2::Ident::new(stringify!($ident), ::proc_macro2::Span::call_site())
};

(raw $ident:literal) => {
::proc_macro2::Ident::new_raw(stringify!($ident), ::proc_macro2::Span::call_site())
};

($ident:expr) => {
::proc_macro2::Ident::new(&$ident, ::proc_macro2::Span::call_site())
};

(raw $ident:expr) => {
::proc_macro2::Ident::new_raw(&$ident, ::proc_macro2::Span::call_site())
};
}

/// Construct a [`syn::Error`] with a message and an optional span.
#[macro_export]
macro_rules! err {
($message:literal) => {
::syn::Error::new(::proc_macro2::Span::call_site(), $message)
};

($message:expr) => {
::syn::Error::new(::proc_macro2::Span::call_site(), $message)
};

($span:ident, $message:expr) => {{
#[allow(unused_imports)]
use ::syn::spanned::Spanned;

::syn::Error::new(($span).span(), $message)
}};

($span:ident, $message:literal) => {{
#[allow(unused_imports)]
use ::syn::spanned::Spanned;

::syn::Error::new(($span).span(), $message)
}};
}
2 changes: 1 addition & 1 deletion crates/remi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This uses Cargo's crate features to implicitilly allow you to pick out which Rem
// azalia-remi = { version = "0.1", features = ["all"], registry = "noelware" }
// tokio = { version = "*", features = ["full"] }
use azalia_remi::{StorageService, Config, remi::StorageService as _, fs::Config as FSConfig};
use azalia_remi::{StorageService, Config, core::StorageService as _, fs::Config as FSConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
Expand Down
6 changes: 3 additions & 3 deletions crates/remi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#![allow(deprecated)] // all #[deprecated] are all the non exhaustive types
#![allow(non_camel_case_types)]

pub use remi;
pub use remi as core;

#[cfg(feature = "gridfs")]
#[cfg_attr(docsrs, doc(cfg(feature = "gridfs")))]
Expand Down Expand Up @@ -94,7 +94,7 @@ pub enum Error {
impl Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
#[cfg(feature = "filesystem")]
#[cfg(feature = "fs")]
Error::Filesystem(err) => Display::fmt(err, f),

#[cfg(feature = "gridfs")]
Expand Down Expand Up @@ -126,7 +126,7 @@ impl Display for Error {
impl error::Error for Error {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match self {
#[cfg(feature = "filesystem")]
#[cfg(feature = "fs")]
Error::Filesystem(err) => Some(err),

#[cfg(feature = "gridfs")]
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# SOFTWARE.

[toolchain]
channel = "1.79"
channel = "1.81"
profile = "minimal"
components = [
"rustc",
Expand Down

0 comments on commit 6e0eb27

Please sign in to comment.