Fix doc tests.

This commit is contained in:
Stephen Chung 2021-03-17 14:45:40 +08:00
parent 6667a22c0c
commit e2a66e0241
2 changed files with 9 additions and 9 deletions

View File

@ -1303,7 +1303,7 @@ pub struct OpAssignment {
/// ///
/// Two separate hashes are pre-calculated because of the following pattern: /// Two separate hashes are pre-calculated because of the following pattern:
/// ///
/// ```rust,no_run /// ```,ignore
/// func(a, b, c); // Native: func(a, b, c) - 3 parameters /// func(a, b, c); // Native: func(a, b, c) - 3 parameters
/// // Script: func(a, b, c) - 3 parameters /// // Script: func(a, b, c) - 3 parameters
/// ///

View File

@ -782,7 +782,7 @@ impl Module {
/// Ok(orig) // return Result<T, Box<EvalAltResult>> /// Ok(orig) // return Result<T, Box<EvalAltResult>>
/// }); /// });
/// ///
/// assert!(module.contains_fn(hash, true)); /// assert!(module.contains_fn(hash));
/// ``` /// ```
#[inline(always)] #[inline(always)]
pub fn set_raw_fn<T: Variant + Clone>( pub fn set_raw_fn<T: Variant + Clone>(
@ -829,7 +829,7 @@ impl Module {
/// ///
/// let mut module = Module::new(); /// let mut module = Module::new();
/// let hash = module.set_native_fn("calc", || Ok(42_i64)); /// let hash = module.set_native_fn("calc", || Ok(42_i64));
/// assert!(module.contains_fn(hash, true)); /// assert!(module.contains_fn(hash));
/// ``` /// ```
#[inline(always)] #[inline(always)]
pub fn set_native_fn<ARGS, T, F>(&mut self, name: impl Into<String>, func: F) -> u64 pub fn set_native_fn<ARGS, T, F>(&mut self, name: impl Into<String>, func: F) -> u64
@ -863,7 +863,7 @@ impl Module {
/// ///
/// let mut module = Module::new(); /// let mut module = Module::new();
/// let hash = module.set_getter_fn("value", |x: &mut i64| { Ok(*x) }); /// let hash = module.set_getter_fn("value", |x: &mut i64| { Ok(*x) });
/// assert!(module.contains_fn(hash, true)); /// assert!(module.contains_fn(hash));
/// ``` /// ```
#[cfg(not(feature = "no_object"))] #[cfg(not(feature = "no_object"))]
#[inline(always)] #[inline(always)]
@ -904,7 +904,7 @@ impl Module {
/// *x = y.len() as i64; /// *x = y.len() as i64;
/// Ok(()) /// Ok(())
/// }); /// });
/// assert!(module.contains_fn(hash, true)); /// assert!(module.contains_fn(hash));
/// ``` /// ```
#[cfg(not(feature = "no_object"))] #[cfg(not(feature = "no_object"))]
#[inline(always)] #[inline(always)]
@ -949,7 +949,7 @@ impl Module {
/// let hash = module.set_indexer_get_fn(|x: &mut i64, y: ImmutableString| { /// let hash = module.set_indexer_get_fn(|x: &mut i64, y: ImmutableString| {
/// Ok(*x + y.len() as i64) /// Ok(*x + y.len() as i64)
/// }); /// });
/// assert!(module.contains_fn(hash, true)); /// assert!(module.contains_fn(hash));
/// ``` /// ```
#[cfg(not(feature = "no_index"))] #[cfg(not(feature = "no_index"))]
#[inline(always)] #[inline(always)]
@ -1010,7 +1010,7 @@ impl Module {
/// *x = y.len() as i64 + value; /// *x = y.len() as i64 + value;
/// Ok(()) /// Ok(())
/// }); /// });
/// assert!(module.contains_fn(hash, true)); /// assert!(module.contains_fn(hash));
/// ``` /// ```
#[cfg(not(feature = "no_index"))] #[cfg(not(feature = "no_index"))]
#[inline(always)] #[inline(always)]
@ -1076,8 +1076,8 @@ impl Module {
/// Ok(()) /// Ok(())
/// } /// }
/// ); /// );
/// assert!(module.contains_fn(hash_get, true)); /// assert!(module.contains_fn(hash_get));
/// assert!(module.contains_fn(hash_set, true)); /// assert!(module.contains_fn(hash_set));
/// ``` /// ```
#[cfg(not(feature = "no_index"))] #[cfg(not(feature = "no_index"))]
#[inline(always)] #[inline(always)]