mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 20:47:01 +01:00
Be calm clippy (#1015)
This commit is contained in:
parent
aa07019b4d
commit
a7ce5baf0b
|
@ -3,12 +3,13 @@
|
||||||
#![deny(clippy::todo)]
|
#![deny(clippy::todo)]
|
||||||
#![deny(clippy::unimplemented)]
|
#![deny(clippy::unimplemented)]
|
||||||
#![deny(clippy::unwrap_used)]
|
#![deny(clippy::unwrap_used)]
|
||||||
#![deny(clippy::expect_used)]
|
|
||||||
#![deny(clippy::panic)]
|
#![deny(clippy::panic)]
|
||||||
#![deny(clippy::unreachable)]
|
#![deny(clippy::unreachable)]
|
||||||
#![deny(clippy::await_holding_lock)]
|
#![deny(clippy::await_holding_lock)]
|
||||||
#![deny(clippy::needless_pass_by_value)]
|
#![deny(clippy::needless_pass_by_value)]
|
||||||
#![deny(clippy::trivially_copy_pass_by_ref)]
|
#![deny(clippy::trivially_copy_pass_by_ref)]
|
||||||
|
// We allow expect since it forces good error messages at the least.
|
||||||
|
#![allow(clippy::expect_used)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate tracing;
|
extern crate tracing;
|
||||||
|
|
|
@ -3,12 +3,13 @@
|
||||||
#![deny(clippy::todo)]
|
#![deny(clippy::todo)]
|
||||||
#![deny(clippy::unimplemented)]
|
#![deny(clippy::unimplemented)]
|
||||||
#![deny(clippy::unwrap_used)]
|
#![deny(clippy::unwrap_used)]
|
||||||
#![deny(clippy::expect_used)]
|
|
||||||
#![deny(clippy::panic)]
|
#![deny(clippy::panic)]
|
||||||
#![deny(clippy::unreachable)]
|
#![deny(clippy::unreachable)]
|
||||||
#![deny(clippy::await_holding_lock)]
|
#![deny(clippy::await_holding_lock)]
|
||||||
#![deny(clippy::needless_pass_by_value)]
|
#![deny(clippy::needless_pass_by_value)]
|
||||||
#![deny(clippy::trivially_copy_pass_by_ref)]
|
#![deny(clippy::trivially_copy_pass_by_ref)]
|
||||||
|
// We allow expect since it forces good error messages at the least.
|
||||||
|
#![allow(clippy::expect_used)]
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use kanidm_cli::KanidmClientParser;
|
use kanidm_cli::KanidmClientParser;
|
||||||
|
|
|
@ -478,8 +478,7 @@ impl AccountCredential {
|
||||||
ClientErrorHttp(status_code, error, _kopid) => {
|
ClientErrorHttp(status_code, error, _kopid) => {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"Error completing command: HTTP{} - {:?}",
|
"Error completing command: HTTP{} - {:?}",
|
||||||
status_code,
|
status_code, error
|
||||||
error.unwrap()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_ => error!("Error starting use_reset_token -> {:?}", e),
|
_ => error!("Error starting use_reset_token -> {:?}", e),
|
||||||
|
@ -496,7 +495,13 @@ impl AccountCredential {
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(cuintent_token) => {
|
Ok(cuintent_token) => {
|
||||||
let mut url = Url::parse(client.get_url()).expect("Invalid server url.");
|
let mut url = match Url::parse(client.get_url()) {
|
||||||
|
Ok(u) => u,
|
||||||
|
Err(e) => {
|
||||||
|
error!("Unable to parse url - {:?}", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
url.set_path("/ui/reset");
|
url.set_path("/ui/reset");
|
||||||
url.query_pairs_mut()
|
url.query_pairs_mut()
|
||||||
.append_pair("token", cuintent_token.token.as_str());
|
.append_pair("token", cuintent_token.token.as_str());
|
||||||
|
@ -666,7 +671,7 @@ async fn totp_enroll_prompt(session_token: &CUSessionToken, client: &KanidmClien
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.interact_text()
|
.interact_text()
|
||||||
.unwrap();
|
.expect("Failed to interact with interactive session");
|
||||||
|
|
||||||
// cancel, submit the reg cancel.
|
// cancel, submit the reg cancel.
|
||||||
let totp_chal = match input.trim().parse::<u32>() {
|
let totp_chal = match input.trim().parse::<u32>() {
|
||||||
|
@ -722,7 +727,7 @@ async fn totp_enroll_prompt(session_token: &CUSessionToken, client: &KanidmClien
|
||||||
.items(&items)
|
.items(&items)
|
||||||
.default(0)
|
.default(0)
|
||||||
.interact()
|
.interact()
|
||||||
.unwrap();
|
.expect("Failed to interact with interactive session");
|
||||||
|
|
||||||
match selection {
|
match selection {
|
||||||
1 => {
|
1 => {
|
||||||
|
@ -801,7 +806,7 @@ async fn passkey_enroll_prompt(session_token: &CUSessionToken, client: &KanidmCl
|
||||||
.with_prompt("\nEnter a label for this Passkey # ")
|
.with_prompt("\nEnter a label for this Passkey # ")
|
||||||
.allow_empty(false)
|
.allow_empty(false)
|
||||||
.interact_text()
|
.interact_text()
|
||||||
.unwrap();
|
.expect("Failed to interact with interactive session");
|
||||||
|
|
||||||
match client
|
match client
|
||||||
.idm_account_credential_update_passkey_finish(session_token, label, rego)
|
.idm_account_credential_update_passkey_finish(session_token, label, rego)
|
||||||
|
@ -814,56 +819,6 @@ async fn passkey_enroll_prompt(session_token: &CUSessionToken, client: &KanidmCl
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// For webauthn later
|
|
||||||
|
|
||||||
/*
|
|
||||||
AccountCredential::RegisterWebauthn(acsopt) => {
|
|
||||||
let client = acsopt.copt.to_client().await;
|
|
||||||
|
|
||||||
let (session, chal) = match client
|
|
||||||
.idm_account_primary_credential_register_webauthn(
|
|
||||||
acsopt.aopts.account_id.as_str(),
|
|
||||||
acsopt.tag.as_str(),
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Ok(v) => v,
|
|
||||||
Err(e) => {
|
|
||||||
error!("Error Starting Registration -> {:?}", e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut wa = WebauthnAuthenticator::new(U2FHid::new());
|
|
||||||
|
|
||||||
eprintln!("Your authenticator will now flash for you to interact with.");
|
|
||||||
|
|
||||||
let rego = match wa.do_registration(client.get_origin(), chal) {
|
|
||||||
Ok(rego) => rego,
|
|
||||||
Err(e) => {
|
|
||||||
error!("Error Signing -> {:?}", e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
match client
|
|
||||||
.idm_account_primary_credential_complete_webuthn_registration(
|
|
||||||
acsopt.aopts.account_id.as_str(),
|
|
||||||
rego,
|
|
||||||
session,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Ok(()) => {
|
|
||||||
println!("Webauthn token registration success.");
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
error!("Error Completing -> {:?}", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
fn display_status(status: CUStatus) {
|
fn display_status(status: CUStatus) {
|
||||||
let CUStatus {
|
let CUStatus {
|
||||||
spn,
|
spn,
|
||||||
|
@ -921,7 +876,7 @@ async fn credential_update_exec(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.interact_text()
|
.interact_text()
|
||||||
.unwrap();
|
.expect("Failed to interact with interactive session");
|
||||||
|
|
||||||
// Get action
|
// Get action
|
||||||
let action = match CUAction::from_str(&input) {
|
let action = match CUAction::from_str(&input) {
|
||||||
|
@ -950,11 +905,11 @@ async fn credential_update_exec(
|
||||||
let password_a = Password::new()
|
let password_a = Password::new()
|
||||||
.with_prompt("New password")
|
.with_prompt("New password")
|
||||||
.interact()
|
.interact()
|
||||||
.unwrap();
|
.expect("Failed to interact with interactive session");
|
||||||
let password_b = Password::new()
|
let password_b = Password::new()
|
||||||
.with_prompt("Confirm password")
|
.with_prompt("Confirm password")
|
||||||
.interact()
|
.interact()
|
||||||
.unwrap();
|
.expect("Failed to interact with interactive session");
|
||||||
|
|
||||||
if password_a != password_b {
|
if password_a != password_b {
|
||||||
eprintln!("Passwords do not match");
|
eprintln!("Passwords do not match");
|
||||||
|
@ -980,7 +935,7 @@ async fn credential_update_exec(
|
||||||
if Confirm::new()
|
if Confirm::new()
|
||||||
.with_prompt("Do you want to remove your totp?")
|
.with_prompt("Do you want to remove your totp?")
|
||||||
.interact()
|
.interact()
|
||||||
.unwrap()
|
.expect("Failed to interact with interactive session")
|
||||||
{
|
{
|
||||||
if let Err(e) = client
|
if let Err(e) = client
|
||||||
.idm_account_credential_update_remove_totp(&session_token)
|
.idm_account_credential_update_remove_totp(&session_token)
|
||||||
|
@ -1022,7 +977,7 @@ async fn credential_update_exec(
|
||||||
if Confirm::new()
|
if Confirm::new()
|
||||||
.with_prompt("Do you want to remove your primary credential?")
|
.with_prompt("Do you want to remove your primary credential?")
|
||||||
.interact()
|
.interact()
|
||||||
.unwrap()
|
.expect("Failed to interact with interactive session")
|
||||||
{
|
{
|
||||||
if let Err(e) = client
|
if let Err(e) = client
|
||||||
.idm_account_credential_update_primary_remove(&session_token)
|
.idm_account_credential_update_primary_remove(&session_token)
|
||||||
|
@ -1068,7 +1023,7 @@ async fn credential_update_exec(
|
||||||
})
|
})
|
||||||
.allow_empty(true)
|
.allow_empty(true)
|
||||||
.interact_text()
|
.interact_text()
|
||||||
.unwrap();
|
.expect("Failed to interact with interactive session");
|
||||||
|
|
||||||
// Remeber, if it's NOT a valid uuid, it must have been empty as a termination.
|
// Remeber, if it's NOT a valid uuid, it must have been empty as a termination.
|
||||||
if let Ok(uuid) = Uuid::parse_str(&uuid_s) {
|
if let Ok(uuid) = Uuid::parse_str(&uuid_s) {
|
||||||
|
@ -1092,7 +1047,7 @@ async fn credential_update_exec(
|
||||||
if Confirm::new()
|
if Confirm::new()
|
||||||
.with_prompt("Do you want to commit your changes?")
|
.with_prompt("Do you want to commit your changes?")
|
||||||
.interact()
|
.interact()
|
||||||
.unwrap()
|
.expect("Failed to interact with interactive session")
|
||||||
{
|
{
|
||||||
if let Err(e) = client
|
if let Err(e) = client
|
||||||
.idm_account_credential_update_commit(&session_token)
|
.idm_account_credential_update_commit(&session_token)
|
||||||
|
|
|
@ -47,7 +47,7 @@ async fn main() {
|
||||||
None => client_builder,
|
None => client_builder,
|
||||||
};
|
};
|
||||||
|
|
||||||
let ca_path = opt.ca_path.as_ref().map(|p| p.to_str()).flatten();
|
let ca_path = opt.ca_path.as_ref().and_then(|p| p.to_str());
|
||||||
let client_builder = match ca_path {
|
let client_builder = match ca_path {
|
||||||
Some(p) => client_builder
|
Some(p) => client_builder
|
||||||
.add_root_certificate_filepath(p)
|
.add_root_certificate_filepath(p)
|
||||||
|
|
|
@ -1475,6 +1475,7 @@ impl<'a> AccessControlsTransaction<'a> for AccessControlsReadTransaction<'a> {
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
impl AccessControls {
|
impl AccessControls {
|
||||||
|
#![allow(clippy::expect_used)]
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
AccessControls {
|
AccessControls {
|
||||||
inner: CowCell::new(AccessControlsInner {
|
inner: CowCell::new(AccessControlsInner {
|
||||||
|
@ -1483,12 +1484,8 @@ impl AccessControls {
|
||||||
acps_modify: Vec::new(),
|
acps_modify: Vec::new(),
|
||||||
acps_delete: Vec::new(),
|
acps_delete: Vec::new(),
|
||||||
}),
|
}),
|
||||||
/*
|
// Allow the expect, if this fails it reperesents a programming/development
|
||||||
acp_related_search_cache: ARCache::new_size(
|
// failure.
|
||||||
ACP_RELATED_SEARCH_CACHE_MAX,
|
|
||||||
ACP_RELATED_SEARCH_CACHE_LOCAL,
|
|
||||||
),
|
|
||||||
*/
|
|
||||||
acp_resolve_filter_cache: ARCacheBuilder::new()
|
acp_resolve_filter_cache: ARCacheBuilder::new()
|
||||||
.set_size(ACP_RESOLVE_FILTER_CACHE_MAX, ACP_RESOLVE_FILTER_CACHE_LOCAL)
|
.set_size(ACP_RESOLVE_FILTER_CACHE_MAX, ACP_RESOLVE_FILTER_CACHE_LOCAL)
|
||||||
.set_reader_quiesce(true)
|
.set_reader_quiesce(true)
|
||||||
|
|
|
@ -407,7 +407,7 @@ fn from_vec_dbval1(attr_val: Vec<DbValueV1>) -> Result<DbValueSetV2, OperationEr
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DbEntry {
|
impl DbEntry {
|
||||||
pub(crate) fn to_v2(self) -> Result<Self, OperationError> {
|
pub(crate) fn convert_to_v2(self) -> Result<Self, OperationError> {
|
||||||
if let DbEntryVers::V1(dbe) = self.ent {
|
if let DbEntryVers::V1(dbe) = self.ent {
|
||||||
dbe.attrs
|
dbe.attrs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
|
@ -865,7 +865,7 @@ impl IdlSqliteWriteTransaction {
|
||||||
admin_error!(?e, "Serde CBOR Error");
|
admin_error!(?e, "Serde CBOR Error");
|
||||||
OperationError::SerdeCborError
|
OperationError::SerdeCborError
|
||||||
})
|
})
|
||||||
.and_then(|dbe: DbEntry| dbe.to_v2())
|
.and_then(|dbe: DbEntry| dbe.convert_to_v2())
|
||||||
.and_then(|dbe| {
|
.and_then(|dbe| {
|
||||||
serde_json::to_vec(&dbe)
|
serde_json::to_vec(&dbe)
|
||||||
.map(|data| IdRawEntry { id: raw.id, data })
|
.map(|data| IdRawEntry { id: raw.id, data })
|
||||||
|
|
|
@ -1494,7 +1494,7 @@ impl<'a> BackendWriteTransaction<'a> {
|
||||||
// Migrate any v1 entries to v2 if needed.
|
// Migrate any v1 entries to v2 if needed.
|
||||||
let dbentries = dbentries
|
let dbentries = dbentries
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|dbe| dbe.to_v2())
|
.map(|dbe| dbe.convert_to_v2())
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
|
|
||||||
// Now, we setup all the entries with new ids.
|
// Now, we setup all the entries with new ids.
|
||||||
|
|
|
@ -1782,8 +1782,9 @@ impl<VALID, STATE> Entry<VALID, STATE> {
|
||||||
let r = vs.insert_checked(value);
|
let r = vs.insert_checked(value);
|
||||||
debug_assert!(r.is_ok());
|
debug_assert!(r.is_ok());
|
||||||
} else {
|
} else {
|
||||||
|
#[allow(clippy::expect_used)]
|
||||||
let vs = valueset::from_value_iter(std::iter::once(value))
|
let vs = valueset::from_value_iter(std::iter::once(value))
|
||||||
.expect("Unable to fail - not empty, and only one type!");
|
.expect("Unable to fail - non-zero iter, and single value type!");
|
||||||
self.attrs.insert(AttrString::from(attr), vs);
|
self.attrs.insert(AttrString::from(attr), vs);
|
||||||
}
|
}
|
||||||
// Doesn't matter if it already exists, equality will replace.
|
// Doesn't matter if it already exists, equality will replace.
|
||||||
|
|
|
@ -163,6 +163,9 @@ pub struct CredentialUpdateSessionStatus {
|
||||||
mfaregstate: MfaRegStateStatus,
|
mfaregstate: MfaRegStateStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We allow Into here because CUStatus is foreign so it's impossible for us to implement From
|
||||||
|
// in a valid manner
|
||||||
|
#[allow(clippy::from_over_into)]
|
||||||
impl Into<CUStatus> for CredentialUpdateSessionStatus {
|
impl Into<CUStatus> for CredentialUpdateSessionStatus {
|
||||||
fn into(self) -> CUStatus {
|
fn into(self) -> CUStatus {
|
||||||
CUStatus {
|
CUStatus {
|
||||||
|
|
|
@ -33,6 +33,9 @@ impl IntervalActor {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow this because result is the only way to map and ? to bubble up, but we aren't
|
||||||
|
// returning an op-error here because this is in early start up.
|
||||||
|
#[allow(clippy::result_unit_err)]
|
||||||
pub fn start_online_backup(
|
pub fn start_online_backup(
|
||||||
server: &'static QueryServerReadV1,
|
server: &'static QueryServerReadV1,
|
||||||
cfg: &OnlineBackup,
|
cfg: &OnlineBackup,
|
||||||
|
|
|
@ -111,8 +111,9 @@ impl State {
|
||||||
assert!(r.is_ok());
|
assert!(r.is_ok());
|
||||||
// Reject if it fails?
|
// Reject if it fails?
|
||||||
} else {
|
} else {
|
||||||
|
#[allow(clippy::expect_used)]
|
||||||
let vs = valueset::from_value_iter(std::iter::once(value.as_ref().clone()))
|
let vs = valueset::from_value_iter(std::iter::once(value.as_ref().clone()))
|
||||||
.expect("Unable to fail - not empty, and only one type!");
|
.expect("Unable to fail - always single value, and only one type!");
|
||||||
attrs.insert(attr.clone(), vs);
|
attrs.insert(attr.clone(), vs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1366,12 +1366,6 @@ impl Value {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_partialvalue(&self) -> PartialValue {
|
|
||||||
// Match on self to become a partialvalue.
|
|
||||||
// self.pv.clone()
|
|
||||||
unimplemented!();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn to_utf8(self) -> Option<String> {
|
pub fn to_utf8(self) -> Option<String> {
|
||||||
match self {
|
match self {
|
||||||
Value::Utf8(s) => Some(s),
|
Value::Utf8(s) => Some(s),
|
||||||
|
|
|
@ -49,8 +49,10 @@ impl ValueSetAddress {
|
||||||
.collect();
|
.collect();
|
||||||
Ok(Box::new(ValueSetAddress { set }))
|
Ok(Box::new(ValueSetAddress { set }))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
impl FromIterator<Address> for Option<Box<ValueSetAddress>> {
|
||||||
|
fn from_iter<T>(iter: T) -> Option<Box<ValueSetAddress>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = Address>,
|
T: IntoIterator<Item = Address>,
|
||||||
{
|
{
|
||||||
|
@ -215,7 +217,10 @@ impl ValueSetEmailAddress {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and tuples are always foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
|
pub fn from_iter<T>(iter: T) -> Option<Box<ValueSetEmailAddress>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = (String, bool)>,
|
T: IntoIterator<Item = (String, bool)>,
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,10 @@ impl ValueSetPrivateBinary {
|
||||||
Ok(Box::new(ValueSetPrivateBinary { set }))
|
Ok(Box::new(ValueSetPrivateBinary { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and vec is foreign
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
|
pub fn from_iter<T>(iter: T) -> Option<Box<ValueSetPrivateBinary>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = Vec<u8>>,
|
T: IntoIterator<Item = Vec<u8>>,
|
||||||
{
|
{
|
||||||
|
@ -157,7 +160,10 @@ impl ValueSetPublicBinary {
|
||||||
Ok(Box::new(ValueSetPublicBinary { map }))
|
Ok(Box::new(ValueSetPublicBinary { map }))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and tuples are always foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
|
pub fn from_iter<T>(iter: T) -> Option<Box<ValueSetPublicBinary>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = (String, Vec<u8>)>,
|
T: IntoIterator<Item = (String, Vec<u8>)>,
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,9 @@ impl ValueSetBool {
|
||||||
Ok(Box::new(ValueSetBool { set }))
|
Ok(Box::new(ValueSetBool { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and bool is foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = bool>,
|
T: IntoIterator<Item = bool>,
|
||||||
|
|
|
@ -34,8 +34,10 @@ impl ValueSetCid {
|
||||||
.collect();
|
.collect();
|
||||||
Ok(Box::new(ValueSetCid { set }))
|
Ok(Box::new(ValueSetCid { set }))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
impl FromIterator<Cid> for Option<Box<ValueSetCid>> {
|
||||||
|
fn from_iter<T>(iter: T) -> Option<Box<ValueSetCid>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = Cid>,
|
T: IntoIterator<Item = Cid>,
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,6 +43,9 @@ impl ValueSetCredential {
|
||||||
Ok(Box::new(ValueSetCredential { map }))
|
Ok(Box::new(ValueSetCredential { map }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and tuples are always foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = (String, Credential)>,
|
T: IntoIterator<Item = (String, Credential)>,
|
||||||
|
@ -214,6 +217,9 @@ impl ValueSetIntentToken {
|
||||||
Ok(Box::new(ValueSetIntentToken { map }))
|
Ok(Box::new(ValueSetIntentToken { map }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and tuples are always foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = (String, IntentTokenState)>,
|
T: IntoIterator<Item = (String, IntentTokenState)>,
|
||||||
|
@ -375,6 +381,9 @@ impl ValueSetPasskey {
|
||||||
Ok(Box::new(ValueSetPasskey { map }))
|
Ok(Box::new(ValueSetPasskey { map }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and tuples are always foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = (Uuid, String, PasskeyV4)>,
|
T: IntoIterator<Item = (Uuid, String, PasskeyV4)>,
|
||||||
|
@ -531,6 +540,9 @@ impl ValueSetDeviceKey {
|
||||||
Ok(Box::new(ValueSetDeviceKey { map }))
|
Ok(Box::new(ValueSetDeviceKey { map }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and tuples are always foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = (Uuid, String, DeviceKeyV4)>,
|
T: IntoIterator<Item = (Uuid, String, DeviceKeyV4)>,
|
||||||
|
|
|
@ -33,6 +33,9 @@ impl ValueSetDateTime {
|
||||||
Ok(Box::new(ValueSetDateTime { set }))
|
Ok(Box::new(ValueSetDateTime { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and offset date time is foreign
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = OffsetDateTime>,
|
T: IntoIterator<Item = OffsetDateTime>,
|
||||||
|
|
|
@ -27,6 +27,9 @@ impl ValueSetIname {
|
||||||
Ok(Box::new(ValueSetIname { set }))
|
Ok(Box::new(ValueSetIname { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and str is foreign
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<'a, T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<'a, T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = &'a str>,
|
T: IntoIterator<Item = &'a str>,
|
||||||
|
|
|
@ -26,7 +26,9 @@ impl ValueSetIndex {
|
||||||
Ok(Box::new(ValueSetIndex { set }))
|
Ok(Box::new(ValueSetIndex { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
// We need to allow this, because there seems to be a bug using it fromiterator in entry.rs
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
|
pub fn from_iter<T>(iter: T) -> Option<Box<ValueSetIndex>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = IndexType>,
|
T: IntoIterator<Item = IndexType>,
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,9 @@ impl ValueSetIutf8 {
|
||||||
Ok(Box::new(ValueSetIutf8 { set }))
|
Ok(Box::new(ValueSetIutf8 { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and str is foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<'a, T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<'a, T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = &'a str>,
|
T: IntoIterator<Item = &'a str>,
|
||||||
|
|
|
@ -29,6 +29,9 @@ impl ValueSetJsonFilter {
|
||||||
Ok(Box::new(ValueSetJsonFilter { set }))
|
Ok(Box::new(ValueSetJsonFilter { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and protofilter is foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = ProtoFilter>,
|
T: IntoIterator<Item = ProtoFilter>,
|
||||||
|
|
|
@ -26,6 +26,9 @@ impl ValueSetNsUniqueId {
|
||||||
Ok(Box::new(ValueSetNsUniqueId { set }))
|
Ok(Box::new(ValueSetNsUniqueId { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and String is foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = String>,
|
T: IntoIterator<Item = String>,
|
||||||
|
|
|
@ -32,6 +32,9 @@ impl ValueSetOauthScope {
|
||||||
Ok(Box::new(ValueSetOauthScope { set }))
|
Ok(Box::new(ValueSetOauthScope { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and String is foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = String>,
|
T: IntoIterator<Item = String>,
|
||||||
|
@ -178,6 +181,9 @@ impl ValueSetOauthScopeMap {
|
||||||
Ok(Box::new(ValueSetOauthScopeMap { map }))
|
Ok(Box::new(ValueSetOauthScopeMap { map }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and tuples are always foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = (Uuid, BTreeSet<String>)>,
|
T: IntoIterator<Item = (Uuid, BTreeSet<String>)>,
|
||||||
|
|
|
@ -25,6 +25,9 @@ impl ValueSetRestricted {
|
||||||
Ok(Box::new(ValueSetRestricted { set }))
|
Ok(Box::new(ValueSetRestricted { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and String is foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = String>,
|
T: IntoIterator<Item = String>,
|
||||||
|
|
|
@ -25,6 +25,9 @@ impl ValueSetSecret {
|
||||||
Ok(Box::new(ValueSetSecret { set }))
|
Ok(Box::new(ValueSetSecret { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and String is foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = String>,
|
T: IntoIterator<Item = String>,
|
||||||
|
|
|
@ -26,6 +26,9 @@ impl ValueSetSpn {
|
||||||
Ok(Box::new(ValueSetSpn { set }))
|
Ok(Box::new(ValueSetSpn { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and tuples are always foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = (String, String)>,
|
T: IntoIterator<Item = (String, String)>,
|
||||||
|
|
|
@ -28,6 +28,9 @@ impl ValueSetSshKey {
|
||||||
Ok(Box::new(ValueSetSshKey { map }))
|
Ok(Box::new(ValueSetSshKey { map }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and tuples are always foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = (String, String)>,
|
T: IntoIterator<Item = (String, String)>,
|
||||||
|
|
|
@ -25,8 +25,10 @@ impl ValueSetSyntax {
|
||||||
let set = set.map_err(|()| OperationError::InvalidValueState)?;
|
let set = set.map_err(|()| OperationError::InvalidValueState)?;
|
||||||
Ok(Box::new(ValueSetSyntax { set }))
|
Ok(Box::new(ValueSetSyntax { set }))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
impl FromIterator<SyntaxType> for Option<Box<ValueSetSyntax>> {
|
||||||
|
fn from_iter<T>(iter: T) -> Option<Box<ValueSetSyntax>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = SyntaxType>,
|
T: IntoIterator<Item = SyntaxType>,
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,9 @@ impl ValueSetUint32 {
|
||||||
Ok(Box::new(ValueSetUint32 { set }))
|
Ok(Box::new(ValueSetUint32 { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and u32 is foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = u32>,
|
T: IntoIterator<Item = u32>,
|
||||||
|
|
|
@ -25,6 +25,9 @@ impl ValueSetUrl {
|
||||||
Ok(Box::new(ValueSetUrl { set }))
|
Ok(Box::new(ValueSetUrl { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and Url is foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = Url>,
|
T: IntoIterator<Item = Url>,
|
||||||
|
|
|
@ -28,6 +28,9 @@ impl ValueSetUuid {
|
||||||
Ok(Box::new(ValueSetUuid { set }))
|
Ok(Box::new(ValueSetUuid { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and uuid is foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = Uuid>,
|
T: IntoIterator<Item = Uuid>,
|
||||||
|
@ -170,6 +173,9 @@ impl ValueSetRefer {
|
||||||
Ok(Box::new(ValueSetRefer { set }))
|
Ok(Box::new(ValueSetRefer { set }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to allow this, because rust doesn't allow us to impl FromIterator on foreign
|
||||||
|
// types, and uuid is foreign.
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
pub fn from_iter<T>(iter: T) -> Option<Box<Self>>
|
||||||
where
|
where
|
||||||
T: IntoIterator<Item = Uuid>,
|
T: IntoIterator<Item = Uuid>,
|
||||||
|
|
Loading…
Reference in a new issue