Skip to content

Commit 16e14aa

Browse files
authored
Add missing_docs lints, and supplementary documents. (#96)
1 parent 0b133fe commit 16e14aa

File tree

25 files changed

+635
-158
lines changed

25 files changed

+635
-158
lines changed

phper-alloc/src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
99
// See the Mulan PSL v2 for more details.
1010

11-
#![warn(rust_2018_idioms, clippy::dbg_macro, clippy::print_stdout)]
11+
#![warn(rust_2018_idioms, missing_docs)]
12+
#![warn(clippy::dbg_macro, clippy::print_stdout)]
1213
#![doc = include_str!("../README.md")]
1314

1415
#[macro_use]
@@ -51,7 +52,7 @@ impl<T> EBox<T> {
5152
///
5253
/// # Safety
5354
///
54-
/// Make sure the pointer is created from `emalloc`.
55+
/// Make sure the pointer is from `into_raw`, or created from `emalloc`.
5556
pub unsafe fn from_raw(raw: *mut T) -> Self {
5657
Self { ptr: raw }
5758
}
@@ -63,6 +64,7 @@ impl<T> EBox<T> {
6364
ManuallyDrop::new(b).ptr
6465
}
6566

67+
/// Consumes the `EBox`, returning the wrapped value.
6668
pub fn into_inner(self) -> T {
6769
unsafe { self.ptr.read() }
6870
}
@@ -94,13 +96,16 @@ impl<T> Drop for EBox<T> {
9496
/// Duplicate an object without deep copy, but to only add the refcount, for php
9597
/// refcount struct.
9698
pub trait ToRefOwned {
99+
/// The resulting type after obtaining ownership.
97100
type Owned: Borrow<Self>;
98101

102+
/// Creates owned data from borrowed data, by increasing refcount.
99103
fn to_ref_owned(&mut self) -> Self::Owned;
100104
}
101105

102106
/// Duplicate an object without deep copy, but to only add the refcount, for php
103107
/// refcount struct.
104108
pub trait RefClone {
109+
/// Returns a refcount value with same reference of the value.
105110
fn ref_clone(&mut self) -> Self;
106111
}

phper-build/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
99
// See the Mulan PSL v2 for more details.
1010

11-
#![warn(rust_2018_idioms, clippy::dbg_macro)]
11+
#![warn(rust_2018_idioms, missing_docs)]
12+
#![warn(clippy::dbg_macro)]
1213
#![doc = include_str!("../README.md")]
1314

1415
use phper_sys::*;
1516

17+
/// Register all php build relative configure parameters, used in `build.rs`.
1618
pub fn register_all() {
1719
register_link_args();
1820
register_configures();
@@ -43,6 +45,7 @@ pub fn register_configures() {
4345
}
4446
}
4547

48+
/// Register link arguments for os-specified situation.
4649
pub fn register_link_args() {
4750
#[cfg(target_os = "macos")]
4851
{

phper-doc/doc/_04_zval/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ Now you can use `as_*` or `expect_*` methods to convert ZVal to Rust types.
5959
[phper::errors::ExpectTypeError] will be returned, with the message:
6060
`type error: must be of type {expect_type}, {actual_type} given")`.
6161

62-
6362
### Example
6463

6564
```rust,no_run

phper-doc/doc/_06_class_and_object/index.md

Lines changed: 0 additions & 3 deletions
This file was deleted.
File renamed without changes.

phper-doc/src/lib.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
99
// See the Mulan PSL v2 for more details.
1010

11-
#![warn(rust_2018_idioms, clippy::dbg_macro)]
11+
#![warn(rust_2018_idioms, missing_docs)]
12+
#![warn(clippy::dbg_macro, clippy::print_stdout)]
1213
#![doc = include_str!("../README.md")]
1314

1415
pub use phper;
@@ -45,11 +46,8 @@ pub mod _05_internal_types {
4546
pub mod _03_z_obj {}
4647
}
4748

48-
#[doc = include_str!("../doc/_06_class_and_object/index.md")]
49-
pub mod _06_class_and_object {}
50-
51-
#[doc = include_str!("../doc/_07_module/index.md")]
52-
pub mod _07_module {
49+
#[doc = include_str!("../doc/_06_module/index.md")]
50+
pub mod _06_module {
5351

5452
/// TODO
5553
pub mod _01_hooks {}
@@ -65,19 +63,22 @@ pub mod _07_module {
6563

6664
/// TODO
6765
pub mod _05_extension_information {}
66+
67+
/// TODO
68+
pub mod _06_register_class {}
6869
}
6970

7071
/// TODO
71-
pub mod _08_allocation {}
72+
pub mod _07_allocation {}
7273

7374
/// TODO
74-
pub mod _09_handle_exception {}
75+
pub mod _08_handle_exception {}
7576

7677
/// TODO
77-
pub mod _10_build_script {}
78+
pub mod _09_build_script {}
7879

7980
/// TODO
80-
pub mod _11_integration_tests {}
81+
pub mod _10_integration_tests {}
8182

8283
/// TODO
83-
pub mod _12_macros {}
84+
pub mod _11_macros {}

phper-macros/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
99
// See the Mulan PSL v2 for more details.
1010

11-
#![warn(rust_2018_idioms, clippy::dbg_macro, clippy::print_stdout)]
11+
#![warn(rust_2018_idioms, missing_docs)]
12+
#![warn(clippy::dbg_macro, clippy::print_stdout)]
1213
#![doc = include_str!("../README.md")]
1314

1415
// TODO Write a bridge macro for easy usage about register functions and

phper-sys/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
99
// See the Mulan PSL v2 for more details.
1010

11-
#![warn(rust_2018_idioms, clippy::dbg_macro, clippy::print_stdout)]
11+
#![warn(rust_2018_idioms)]
12+
#![warn(clippy::dbg_macro, clippy::print_stdout)]
1213
#![allow(non_upper_case_globals)]
1314
#![allow(non_camel_case_types)]
1415
#![allow(non_snake_case)]

phper-test/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
99
// See the Mulan PSL v2 for more details.
1010

11-
#![warn(rust_2018_idioms, clippy::dbg_macro, clippy::print_stdout)]
11+
#![warn(rust_2018_idioms, missing_docs)]
12+
#![warn(clippy::dbg_macro, clippy::print_stdout)]
1213
#![cfg_attr(docsrs, feature(doc_cfg))]
1314
#![doc = include_str!("../README.md")]
1415

phper-test/src/utils.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
99
// See the Mulan PSL v2 for more details.
1010

11+
//! Utils for PHP test situation.
12+
1113
use std::{
1214
ffi::{OsStr, OsString},
1315
fmt::Debug,
@@ -59,6 +61,7 @@ pub(crate) fn spawn_command<S: AsRef<OsStr> + Debug>(
5961
child
6062
}
6163

64+
/// Get the dynamic link library path generated by `cargo build`.
6265
pub fn get_lib_path(target_path: impl AsRef<Path>, package_name: &str) -> PathBuf {
6366
let target_path = target_path.as_ref();
6467
let mut path = target_path.to_path_buf();

0 commit comments

Comments
 (0)