mirror of
https://github.com/bytedream/serde-inline-default.git
synced 2026-11-04 15:12:09 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6eea08da2d | ||
|
|
473210c388 | ||
|
|
0cc4052eaf | ||
|
|
d197326c32 | ||
|
|
71cdef9d6e | ||
|
|
6132d5369f | ||
|
|
2865e49da3 | ||
|
|
a44606e99c | ||
|
|
5cafcf3e3f |
No files matched your search
@@ -1,6 +0,0 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: cargo
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
+27
-14
@@ -2,30 +2,43 @@ name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
tags-ignore:
|
||||
- "**"
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Generate cargo lockfile
|
||||
run: cargo generate-lockfile
|
||||
|
||||
- name: Cargo cache
|
||||
uses: actions/cache@v3
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
toolchain: stable
|
||||
|
||||
- name: Test
|
||||
run: cargo test
|
||||
|
||||
verify-msrv:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Install cargo-msrv
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: cargo-msrv
|
||||
|
||||
- name: Verify msrv
|
||||
run: cargo msrv verify --all-features
|
||||
@@ -8,10 +8,16 @@ on:
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Publish crate
|
||||
run: cargo publish --token ${{ secrets.CRATES_TOKEN }}
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}
|
||||
run: cargo publish
|
||||
+5
-3
@@ -1,23 +1,25 @@
|
||||
[package]
|
||||
name = "serde-inline-default"
|
||||
version = "1.0.1"
|
||||
version = "1.0.3"
|
||||
authors = ["bytedream"]
|
||||
edition = "2021"
|
||||
rust-version = "1.71.0"
|
||||
description = "Serde default values via inline declaration"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/bytedream/serde-inline-default"
|
||||
license = "MIT OR Apache-2.0"
|
||||
keywords = ["serde", "serialization"]
|
||||
categories = ["encoding"]
|
||||
include = ["/Cargo.toml", "/LICENSE-APACHE", "/LICENSE-MIT", "/README.md", "/src/**", "/tests/**"]
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
doctest = false
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "1.0"
|
||||
quote = "1.0"
|
||||
syn = { version = "2.0", features = ["full"] }
|
||||
syn = { version = "3.0", features = ["full"] }
|
||||
|
||||
[dev-dependencies]
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
||||
+2
-1
@@ -26,7 +26,7 @@ pub(crate) fn type_lifetimes_to_static(ty: &mut Type) {
|
||||
}
|
||||
PathArguments::Parenthesized(parenthesized) => {
|
||||
for input in &mut parenthesized.inputs {
|
||||
type_lifetimes_to_static(input)
|
||||
type_lifetimes_to_static(&mut input.ty)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,7 @@ pub(crate) fn check_field_for_default_expr(
|
||||
let default_fn_expr = quote! {
|
||||
#[doc(hidden)]
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
#( #cfg_attrs )*
|
||||
fn #default_fn_ident () -> #return_type {
|
||||
#default_expr
|
||||
|
||||
Reference in new issue
Block a user