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
|
||||
# We need to keep the user as 1001 to match the GitHub runner's UID.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Keep tracking base image
|
||||
FROM rust:1.85-slim-bookworm
|
||||
FROM rust:1.89-slim-bookworm
|
||||
|
||||
# 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"
|
||||
|
||||
@@ -24,7 +24,7 @@ on:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
MSRV: "1.89"
|
||||
|
||||
### CI Docs
|
||||
|
||||
@@ -88,6 +88,12 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
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
|
||||
with:
|
||||
path: |
|
||||
@@ -99,8 +105,6 @@ jobs:
|
||||
key: lldap-ui-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
lldap-ui-
|
||||
- name: Add wasm target (rust)
|
||||
run: rustup target add wasm32-unknown-unknown
|
||||
- name: Install wasm-pack with cargo
|
||||
run: cargo install wasm-pack || true
|
||||
env:
|
||||
@@ -133,6 +137,12 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
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
|
||||
with:
|
||||
path: |
|
||||
|
||||
@@ -8,7 +8,7 @@ on:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
MSRV: 1.85.0
|
||||
MSRV: "1.89"
|
||||
|
||||
jobs:
|
||||
pre_job:
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
toolchain: "${{ env.MSRV }}"
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Build
|
||||
run: cargo build --verbose --workspace
|
||||
run: cargo +${{steps.toolchain.outputs.name}} build --verbose --workspace
|
||||
- name: Run tests
|
||||
run: cargo +${{steps.toolchain.outputs.name}} test --verbose --workspace
|
||||
- name: Generate GraphQL schema
|
||||
|
||||
@@ -16,6 +16,7 @@ edition = "2024"
|
||||
homepage = "https://github.com/lldap/lldap"
|
||||
license = "GPL-3.0-only"
|
||||
repository = "https://github.com/lldap/lldap"
|
||||
rust-version = "1.89"
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
||||
@@ -8,6 +8,7 @@ authors.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
|
||||
@@ -147,20 +147,18 @@ impl Component for JpegFileInput {
|
||||
true
|
||||
}
|
||||
Msg::FileLoaded(file_name, data) => {
|
||||
if let Some(avatar) = &mut self.avatar {
|
||||
if let Some(file) = &avatar.file {
|
||||
if file.name() == file_name {
|
||||
if let Result::Ok(data) = data {
|
||||
if !is_valid_jpeg(data.as_slice()) {
|
||||
// Clear the selection.
|
||||
self.avatar = Some(JsFile::default());
|
||||
// TODO: bail!("Chosen image is not a valid JPEG");
|
||||
} else {
|
||||
avatar.contents = Some(data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(avatar) = &mut self.avatar
|
||||
&& let Some(file) = &avatar.file
|
||||
&& file.name() == file_name
|
||||
&& let Result::Ok(data) = data
|
||||
{
|
||||
if !is_valid_jpeg(data.as_slice()) {
|
||||
// Clear the selection.
|
||||
self.avatar = Some(JsFile::default());
|
||||
// TODO: bail!("Chosen image is not a valid JPEG");
|
||||
} else {
|
||||
avatar.contents = Some(data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
self.reader = None;
|
||||
|
||||
@@ -8,7 +8,7 @@ pub mod group {
|
||||
|
||||
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 {
|
||||
"creation_date" => Some(AttributeDescription {
|
||||
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) {
|
||||
Some(d) => d,
|
||||
None => AttributeDescription {
|
||||
@@ -55,7 +55,7 @@ pub mod user {
|
||||
|
||||
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 {
|
||||
"avatar" => Some(AttributeDescription {
|
||||
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) {
|
||||
Some(d) => d,
|
||||
None => AttributeDescription {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#![forbid(non_ascii_idents)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
#![allow(clippy::let_unit_value)]
|
||||
#![allow(clippy::unnecessary_operation)] // Doesn't work well with the html macro.
|
||||
|
||||
pub mod components;
|
||||
pub mod infra;
|
||||
|
||||
@@ -7,6 +7,7 @@ edition.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
tracing = "*"
|
||||
|
||||
@@ -7,6 +7,7 @@ authors.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["opaque_server", "opaque_client"]
|
||||
|
||||
@@ -6,6 +6,7 @@ authors.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[features]
|
||||
test = []
|
||||
|
||||
@@ -6,6 +6,7 @@ authors.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[features]
|
||||
test = []
|
||||
|
||||
@@ -9,6 +9,7 @@ edition.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[features]
|
||||
test = []
|
||||
|
||||
@@ -7,6 +7,7 @@ edition.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies.serde]
|
||||
workspace = true
|
||||
|
||||
@@ -7,6 +7,7 @@ authors.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow = "*"
|
||||
@@ -72,4 +73,4 @@ path = "../test-utils"
|
||||
|
||||
[dev-dependencies.tokio]
|
||||
features = ["full"]
|
||||
version = "1.25"
|
||||
version = "1.25"
|
||||
|
||||
@@ -7,6 +7,7 @@ edition.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow = "*"
|
||||
@@ -63,4 +64,4 @@ version = "1.25"
|
||||
|
||||
[dev-dependencies.lldap_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 {
|
||||
if request.base.is_empty() && request.scope == LdapSearchScope::Base {
|
||||
if let LdapFilter::Present(attribute) = &request.filter {
|
||||
if attribute.eq_ignore_ascii_case("objectclass") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if request.base.is_empty()
|
||||
&& request.scope == LdapSearchScope::Base
|
||||
&& let LdapFilter::Present(attribute) = &request.filter
|
||||
&& attribute.eq_ignore_ascii_case("objectclass")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ edition.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[features]
|
||||
test = []
|
||||
|
||||
@@ -7,6 +7,7 @@ edition.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[features]
|
||||
test = []
|
||||
|
||||
@@ -6,6 +6,7 @@ edition.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
async-trait = "0.1"
|
||||
|
||||
@@ -7,3 +7,4 @@ edition.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
@@ -7,6 +7,7 @@ authors.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow = "*"
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
[toolchain]
|
||||
channel = "1.89"
|
||||
@@ -9,6 +9,7 @@ authors.workspace = true
|
||||
homepage.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
actix = "0.13"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(dead_code)]
|
||||
use crate::common::env;
|
||||
use anyhow::{Context, Result, anyhow};
|
||||
use graphql_client::GraphQLQuery;
|
||||
|
||||
@@ -7,6 +7,7 @@ authors.workspace = true
|
||||
homepage.workspace = true
|
||||
license.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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user