mirror of
https://github.com/lldap/lldap.git
synced 2026-03-31 15:07:48 +01:00
chore: upgrade Rust toolchain to 1.89 and modernize code with let-chains
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
FROM rust:1.85
|
FROM rust:1.89
|
||||||
|
|
||||||
ARG USERNAME=lldapdev
|
ARG USERNAME=lldapdev
|
||||||
# We need to keep the user as 1001 to match the GitHub runner's UID.
|
# We need to keep the user as 1001 to match the GitHub runner's UID.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Keep tracking base image
|
# Keep tracking base image
|
||||||
FROM rust:1.85-slim-bookworm
|
FROM rust:1.89-slim-bookworm
|
||||||
|
|
||||||
# Set needed env path
|
# Set needed env path
|
||||||
ENV PATH="/opt/armv7l-linux-musleabihf-cross/:/opt/armv7l-linux-musleabihf-cross/bin/:/opt/aarch64-linux-musl-cross/:/opt/aarch64-linux-musl-cross/bin/:/opt/x86_64-linux-musl-cross/:/opt/x86_64-linux-musl-cross/bin/:$PATH"
|
ENV PATH="/opt/armv7l-linux-musleabihf-cross/:/opt/armv7l-linux-musleabihf-cross/bin/:/opt/aarch64-linux-musl-cross/:/opt/aarch64-linux-musl-cross/bin/:/opt/x86_64-linux-musl-cross/:/opt/x86_64-linux-musl-cross/bin/:$PATH"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
MSRV: "1.89"
|
||||||
|
|
||||||
### CI Docs
|
### CI Docs
|
||||||
|
|
||||||
@@ -88,6 +88,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v5.0.0
|
uses: actions/checkout@v5.0.0
|
||||||
|
- name: Install Rust
|
||||||
|
id: toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: "${{ env.MSRV }}"
|
||||||
|
targets: "wasm32-unknown-unknown"
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
@@ -99,8 +105,6 @@ jobs:
|
|||||||
key: lldap-ui-${{ hashFiles('**/Cargo.lock') }}
|
key: lldap-ui-${{ hashFiles('**/Cargo.lock') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
lldap-ui-
|
lldap-ui-
|
||||||
- name: Add wasm target (rust)
|
|
||||||
run: rustup target add wasm32-unknown-unknown
|
|
||||||
- name: Install wasm-pack with cargo
|
- name: Install wasm-pack with cargo
|
||||||
run: cargo install wasm-pack || true
|
run: cargo install wasm-pack || true
|
||||||
env:
|
env:
|
||||||
@@ -133,6 +137,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v5.0.0
|
uses: actions/checkout@v5.0.0
|
||||||
|
- name: Install Rust
|
||||||
|
id: toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: "${{ env.MSRV }}"
|
||||||
|
targets: "${{ matrix.target }}"
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
MSRV: 1.85.0
|
MSRV: "1.89"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pre_job:
|
pre_job:
|
||||||
@@ -42,7 +42,7 @@ jobs:
|
|||||||
toolchain: "${{ env.MSRV }}"
|
toolchain: "${{ env.MSRV }}"
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --verbose --workspace
|
run: cargo +${{steps.toolchain.outputs.name}} build --verbose --workspace
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo +${{steps.toolchain.outputs.name}} test --verbose --workspace
|
run: cargo +${{steps.toolchain.outputs.name}} test --verbose --workspace
|
||||||
- name: Generate GraphQL schema
|
- name: Generate GraphQL schema
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ edition = "2024"
|
|||||||
homepage = "https://github.com/lldap/lldap"
|
homepage = "https://github.com/lldap/lldap"
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
repository = "https://github.com/lldap/lldap"
|
repository = "https://github.com/lldap/lldap"
|
||||||
|
rust-version = "1.89"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ authors.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
|
|||||||
@@ -147,20 +147,18 @@ impl Component for JpegFileInput {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
Msg::FileLoaded(file_name, data) => {
|
Msg::FileLoaded(file_name, data) => {
|
||||||
if let Some(avatar) = &mut self.avatar {
|
if let Some(avatar) = &mut self.avatar
|
||||||
if let Some(file) = &avatar.file {
|
&& let Some(file) = &avatar.file
|
||||||
if file.name() == file_name {
|
&& file.name() == file_name
|
||||||
if let Result::Ok(data) = data {
|
&& let Result::Ok(data) = data
|
||||||
if !is_valid_jpeg(data.as_slice()) {
|
{
|
||||||
// Clear the selection.
|
if !is_valid_jpeg(data.as_slice()) {
|
||||||
self.avatar = Some(JsFile::default());
|
// Clear the selection.
|
||||||
// TODO: bail!("Chosen image is not a valid JPEG");
|
self.avatar = Some(JsFile::default());
|
||||||
} else {
|
// TODO: bail!("Chosen image is not a valid JPEG");
|
||||||
avatar.contents = Some(data);
|
} else {
|
||||||
return true;
|
avatar.contents = Some(data);
|
||||||
}
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.reader = None;
|
self.reader = None;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ pub mod group {
|
|||||||
|
|
||||||
use super::AttributeDescription;
|
use super::AttributeDescription;
|
||||||
|
|
||||||
pub fn resolve_group_attribute_description(name: &str) -> Option<AttributeDescription> {
|
pub fn resolve_group_attribute_description(name: &str) -> Option<AttributeDescription<'_>> {
|
||||||
match name {
|
match name {
|
||||||
"creation_date" => Some(AttributeDescription {
|
"creation_date" => Some(AttributeDescription {
|
||||||
attribute_identifier: name,
|
attribute_identifier: name,
|
||||||
@@ -39,7 +39,7 @@ pub mod group {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resolve_group_attribute_description_or_default(name: &str) -> AttributeDescription {
|
pub fn resolve_group_attribute_description_or_default(name: &str) -> AttributeDescription<'_> {
|
||||||
match resolve_group_attribute_description(name) {
|
match resolve_group_attribute_description(name) {
|
||||||
Some(d) => d,
|
Some(d) => d,
|
||||||
None => AttributeDescription {
|
None => AttributeDescription {
|
||||||
@@ -55,7 +55,7 @@ pub mod user {
|
|||||||
|
|
||||||
use super::AttributeDescription;
|
use super::AttributeDescription;
|
||||||
|
|
||||||
pub fn resolve_user_attribute_description(name: &str) -> Option<AttributeDescription> {
|
pub fn resolve_user_attribute_description(name: &str) -> Option<AttributeDescription<'_>> {
|
||||||
match name {
|
match name {
|
||||||
"avatar" => Some(AttributeDescription {
|
"avatar" => Some(AttributeDescription {
|
||||||
attribute_identifier: name,
|
attribute_identifier: name,
|
||||||
@@ -111,7 +111,7 @@ pub mod user {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resolve_user_attribute_description_or_default(name: &str) -> AttributeDescription {
|
pub fn resolve_user_attribute_description_or_default(name: &str) -> AttributeDescription<'_> {
|
||||||
match resolve_user_attribute_description(name) {
|
match resolve_user_attribute_description(name) {
|
||||||
Some(d) => d,
|
Some(d) => d,
|
||||||
None => AttributeDescription {
|
None => AttributeDescription {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#![forbid(non_ascii_idents)]
|
#![forbid(non_ascii_idents)]
|
||||||
#![allow(clippy::uninlined_format_args)]
|
#![allow(clippy::uninlined_format_args)]
|
||||||
#![allow(clippy::let_unit_value)]
|
#![allow(clippy::let_unit_value)]
|
||||||
|
#![allow(clippy::unnecessary_operation)] // Doesn't work well with the html macro.
|
||||||
|
|
||||||
pub mod components;
|
pub mod components;
|
||||||
pub mod infra;
|
pub mod infra;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ edition.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tracing = "*"
|
tracing = "*"
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ authors.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["opaque_server", "opaque_client"]
|
default = ["opaque_server", "opaque_client"]
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ authors.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
test = []
|
test = []
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ authors.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
test = []
|
test = []
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ edition.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
test = []
|
test = []
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ edition.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies.serde]
|
[dependencies.serde]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ authors.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "*"
|
anyhow = "*"
|
||||||
@@ -72,4 +73,4 @@ path = "../test-utils"
|
|||||||
|
|
||||||
[dev-dependencies.tokio]
|
[dev-dependencies.tokio]
|
||||||
features = ["full"]
|
features = ["full"]
|
||||||
version = "1.25"
|
version = "1.25"
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ edition.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "*"
|
anyhow = "*"
|
||||||
@@ -63,4 +64,4 @@ version = "1.25"
|
|||||||
|
|
||||||
[dev-dependencies.lldap_domain]
|
[dev-dependencies.lldap_domain]
|
||||||
path = "../domain"
|
path = "../domain"
|
||||||
features = ["test"]
|
features = ["test"]
|
||||||
|
|||||||
@@ -291,12 +291,12 @@ pub fn make_ldap_subschema_entry(schema: PublicSchema) -> LdapOp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn is_root_dse_request(request: &LdapSearchRequest) -> bool {
|
pub(crate) fn is_root_dse_request(request: &LdapSearchRequest) -> bool {
|
||||||
if request.base.is_empty() && request.scope == LdapSearchScope::Base {
|
if request.base.is_empty()
|
||||||
if let LdapFilter::Present(attribute) = &request.filter {
|
&& request.scope == LdapSearchScope::Base
|
||||||
if attribute.eq_ignore_ascii_case("objectclass") {
|
&& let LdapFilter::Present(attribute) = &request.filter
|
||||||
return true;
|
&& attribute.eq_ignore_ascii_case("objectclass")
|
||||||
}
|
{
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ edition.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
test = []
|
test = []
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ edition.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
test = []
|
test = []
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ edition.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
|
|||||||
@@ -7,3 +7,4 @@ edition.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ authors.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "*"
|
anyhow = "*"
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
[toolchain]
|
||||||
|
channel = "1.89"
|
||||||
@@ -9,6 +9,7 @@ authors.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix = "0.13"
|
actix = "0.13"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#![allow(dead_code)]
|
||||||
use crate::common::env;
|
use crate::common::env;
|
||||||
use anyhow::{Context, Result, anyhow};
|
use anyhow::{Context, Result, anyhow};
|
||||||
use graphql_client::GraphQLQuery;
|
use graphql_client::GraphQLQuery;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ authors.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user