Skip to content

Commit

Permalink
Fix feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
oscartbeaumont committed Dec 24, 2023
1 parent d3c7476 commit 48b86ae
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ pub use ctor;
#[cfg(feature = "functions")]
pub use specta_macros::fn_datatype;

use crate::{
functions::{FunctionDataType, SpectaFunction},
DataType, DeprecatedType, Field, SpectaID, Type, TypeMap,
};
use crate::{DataType, DeprecatedType, Field, SpectaID, Type, TypeMap};

/// Functions used to construct `crate::datatype` types (they have private fields so can't be constructed directly).
/// We intentionally keep their fields private so we can modify them without a major version bump.
Expand Down Expand Up @@ -221,26 +218,34 @@ pub fn flatten<T: Type>(sid: SpectaID, type_map: &mut TypeMap, generics: &[DataT
ty
}

#[doc(hidden)]
/// A helper for exporting a command to a [`CommandDataType`].
/// You shouldn't use this directly and instead should use [`fn_datatype!`](crate::fn_datatype).
pub fn get_fn_datatype<TMarker, T: SpectaFunction<TMarker>>(
_: T,
asyncness: bool,
name: Cow<'static, str>,
type_map: &mut TypeMap,
fields: &[Cow<'static, str>],
docs: Cow<'static, str>,
deprecated: Option<DeprecatedType>,
no_return_type: bool,
) -> FunctionDataType {
T::to_datatype(
asyncness,
name,
type_map,
fields,
docs,
deprecated,
no_return_type,
)
#[cfg(feature = "functions")]
mod functions {
use super::*;
use crate::functions::{FunctionDataType, SpectaFunction};

#[doc(hidden)]
/// A helper for exporting a command to a [`CommandDataType`].
/// You shouldn't use this directly and instead should use [`fn_datatype!`](crate::fn_datatype).
pub fn get_fn_datatype<TMarker, T: SpectaFunction<TMarker>>(
_: T,
asyncness: bool,
name: Cow<'static, str>,
type_map: &mut TypeMap,
fields: &[Cow<'static, str>],
docs: Cow<'static, str>,
deprecated: Option<DeprecatedType>,
no_return_type: bool,
) -> FunctionDataType {

Check warning on line 238 in src/internal.rs

View workflow job for this annotation

GitHub Actions / clippy

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7) --> src/internal.rs:229:5 | 229 | / pub fn get_fn_datatype<TMarker, T: SpectaFunction<TMarker>>( 230 | | _: T, 231 | | asyncness: bool, 232 | | name: Cow<'static, str>, ... | 237 | | no_return_type: bool, 238 | | ) -> FunctionDataType { | |_________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments note: the lint level is defined here --> src/lib.rs:3:9 | 3 | #![warn(clippy::all, clippy::unwrap_used, clippy::panic)] // TODO: missing_docs | ^^^^^^^^^^^ = note: `#[warn(clippy::too_many_arguments)]` implied by `#[warn(clippy::all)]`
T::to_datatype(
asyncness,
name,
type_map,
fields,
docs,
deprecated,
no_return_type,
)
}
}
#[cfg(feature = "functions")]
pub use functions::*;

0 comments on commit 48b86ae

Please sign in to comment.