Skip to content

Commit 9f0eb3f

Browse files
committed
doc: fix warnings from "cargo doc"
1 parent 25596a8 commit 9f0eb3f

12 files changed

+23
-22
lines changed

src/edge_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'a> Iterator for EdgeTableIterator<'a> {
7171
/// An immutable view of an edge table.
7272
///
7373
/// These are not created directly.
74-
/// Instead, use [`TableCollection::edges`](crate::TableCollection::edges)
74+
/// Instead, use [`TableAccess::edges`](crate::TableAccess::edges)
7575
/// to get a reference to an existing edge table;
7676
pub struct EdgeTable<'a> {
7777
table_: &'a ll_bindings::tsk_edge_table_t,

src/individual_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl PartialEq for IndividualTableRow {
4444
/// An immutable view of a individual table.
4545
///
4646
/// These are not created directly.
47-
/// Instead, use [`TableCollection::individuals`](crate::TableCollection::individuals)
47+
/// Instead, use [`TableAccess::individuals`](crate::TableAccess::individuals)
4848
/// to get a reference to an existing node table;
4949
pub struct IndividualTable<'a> {
5050
table_: &'a ll_bindings::tsk_individual_table_t,

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,15 +440,15 @@ pub use traits::TskitTypeAccess;
440440
pub use trees::{NodeTraversalOrder, Tree, TreeSequence};
441441

442442
// Optional features
443-
#[cfg(feature = "provenance")]
443+
#[cfg(any(feature = "provenance", doc))]
444444
pub mod provenance;
445445

446+
#[cfg(any(feature = "provenance", doc))]
446447
/// A provenance ID
447448
///
448449
/// This is an integer referring to a row of a [``provenance::ProvenanceTable``].
449450
///
450451
/// The features for this type follow the same pattern as for [``NodeId``]
451-
#[cfg(feature = "provenance")]
452452
#[repr(transparent)]
453453
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, std::hash::Hash)]
454454
pub struct ProvenanceId(tsk_id_t);

src/migration_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl<'a> Iterator for MigrationTableIterator<'a> {
8080
/// An immutable view of a migration table.
8181
///
8282
/// These are not created directly.
83-
/// Instead, use [`TableCollection::migrations`](crate::TableCollection::migrations)
83+
/// Instead, use [`TableAccess::migrations`](crate::TableAccess::migrations)
8484
/// to get a reference to an existing node table;
8585
pub struct MigrationTable<'a> {
8686
table_: &'a ll_bindings::tsk_migration_table_t,

src/mutation_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'a> Iterator for MutationTableIterator<'a> {
7575
/// An immutable view of site table.
7676
///
7777
/// These are not created directly.
78-
/// Instead, use [`TableCollection::mutations`](crate::TableCollection::mutations)
78+
/// Instead, use [`TableAccess::mutations`](crate::TableAccess::mutations)
7979
/// to get a reference to an existing mutation table;
8080
pub struct MutationTable<'a> {
8181
table_: &'a ll_bindings::tsk_mutation_table_t,

src/node_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'a> Iterator for NodeTableIterator<'a> {
7272
/// An immtable view of a node table.
7373
///
7474
/// These are not created directly.
75-
/// Instead, use [`TableCollection::nodes`](crate::TableCollection::nodes)
75+
/// Instead, use [`TableAccess::nodes`](crate::TableAccess::nodes)
7676
/// to get a reference to an existing node table;
7777
pub struct NodeTable<'a> {
7878
table_: &'a ll_bindings::tsk_node_table_t,

src/population_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<'a> Iterator for PopulationTableIterator<'a> {
6262
/// An immutable view of site table.
6363
///
6464
/// These are not created directly.
65-
/// Instead, use [`TableCollection::populations`](crate::TableCollection::populations)
65+
/// Instead, use [`TableAccess::populations`](crate::TableAccess::populations)
6666
/// to get a reference to an existing population table;
6767
pub struct PopulationTable<'a> {
6868
table_: &'a ll_bindings::tsk_population_table_t,

src/provenance.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
//! the following:
55
//!
66
//! * [`crate::TableCollection::add_provenance`]
7-
//! * [`crate::TableCollection::provenances`]
8-
//! * [`crate::TableCollection::provenances_iter`]
7+
//! * [`crate::TableAccess::provenances`]
8+
//! * [`crate::TableAccess::provenances_iter`]
99
//! * [`crate::TreeSequence::add_provenance`]
10-
//! * [`crate::TreeSequence::provenances`]
11-
//! * [`crate::TreeSequence::provenances_iter`]
1210
//! * [`ProvenanceTable`].
1311
//! * [`ProvenanceTableRow`], which is the value type returned by
1412
//! [`ProvenanceTable::iter`].
@@ -87,9 +85,8 @@ impl<'a> Iterator for ProvenanceTableIterator<'a> {
8785
/// An immutable view of a provenance table.
8886
///
8987
/// These are not created directly.
90-
/// Instead, use [`crate::TableCollection::provenances`]
91-
/// or [`crate::TreeSequence::provenances`]
92-
/// to get a reference to an existing node table;
88+
/// Instead, use [`crate::TableAccess::provenances`]
89+
/// to get a reference to an existing provenance table;
9390
///
9491
/// # Notes
9592
///

src/site_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<'a> Iterator for SiteTableIterator<'a> {
6767
/// An immutable view of site table.
6868
///
6969
/// These are not created directly.
70-
/// Instead, use [`TableCollection::sites`](crate::TableCollection::sites)
70+
/// Instead, use [`TableAccess::sites`](crate::TableAccess::sites)
7171
/// to get a reference to an existing site table;
7272
pub struct SiteTable<'a> {
7373
table_: &'a ll_bindings::tsk_site_table_t,

src/table_collection.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ impl TableCollection {
11331133
handle_tsk_return_value!(rv)
11341134
}
11351135

1136-
#[cfg(feature = "provenance")]
1136+
#[cfg(any(feature = "provenance", doc))]
11371137
/// Add provenance record with a time stamp.
11381138
///
11391139
/// All implementation of this trait provided by `tskit` use
@@ -1152,6 +1152,7 @@ impl TableCollection {
11521152
/// ```
11531153
/// use tskit::TableAccess;
11541154
/// let mut tables = tskit::TableCollection::new(1000.).unwrap();
1155+
/// # #[cfg(feature = "provenance")] {
11551156
/// tables.add_provenance(&String::from("Some provenance")).unwrap();
11561157
///
11571158
/// // Get reference to the table
@@ -1179,6 +1180,7 @@ impl TableCollection {
11791180
/// assert_eq!(treeseq.provenances().record(0).unwrap(), "Some provenance");
11801181
/// // We can still compare to row_0 because it is a copy of the row data:
11811182
/// assert_eq!(treeseq.provenances().record(0).unwrap(), row_0.record);
1183+
/// # }
11821184
/// ```
11831185
pub fn add_provenance(&mut self, record: &str) -> Result<crate::ProvenanceId, TskitError> {
11841186
let timestamp = humantime::format_rfc3339(std::time::SystemTime::now()).to_string();
@@ -1224,7 +1226,7 @@ impl TableAccess for TableCollection {
12241226
PopulationTable::new_from_table(&(*self.inner).populations)
12251227
}
12261228

1227-
#[cfg(feature = "provenance")]
1229+
#[cfg(any(feature = "provenance", doc))]
12281230
fn provenances(&self) -> crate::provenance::ProvenanceTable {
12291231
crate::provenance::ProvenanceTable::new_from_table(&(*self.inner).provenances)
12301232
}

src/traits.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ pub trait TableAccess {
113113
Box::new(make_table_iterator::<IndividualTable>(self.individuals()))
114114
}
115115

116-
#[cfg(feature = "provenance")]
116+
#[cfg(any(feature = "provenance", doc))]
117117
/// Get reference to the [``ProvenanceTable``](crate::provenance::ProvenanceTable)
118118
fn provenances(&self) -> crate::provenance::ProvenanceTable;
119119

120-
#[cfg(feature = "provenance")]
120+
#[cfg(any(feature = "provenance", doc))]
121121
/// Return an iterator over provenances
122122
fn provenances_iter(
123123
&self,

src/trees.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ impl TreeSequence {
12261226
)
12271227
}
12281228

1229-
#[cfg(feature = "provenance")]
1229+
#[cfg(any(feature = "provenance", doc))]
12301230
/// Add provenance record with a time stamp.
12311231
///
12321232
/// All implementation of this trait provided by `tskit` use
@@ -1245,6 +1245,7 @@ impl TreeSequence {
12451245
///
12461246
/// let mut tables = tskit::TableCollection::new(1000.).unwrap();
12471247
/// let mut treeseq = tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
1248+
/// # #[cfg(feature = "provenance")] {
12481249
/// treeseq.add_provenance(&String::from("All your provenance r belong 2 us.")).unwrap();
12491250
///
12501251
/// let prov_ref = treeseq.provenances();
@@ -1257,6 +1258,7 @@ impl TreeSequence {
12571258
/// use core::str::FromStr;
12581259
/// let dt_utc = humantime::Timestamp::from_str(&timestamp).unwrap();
12591260
/// println!("utc = {}", dt_utc);
1261+
/// # }
12601262
/// ```
12611263
pub fn add_provenance(&mut self, record: &str) -> Result<crate::ProvenanceId, TskitError> {
12621264
let timestamp = humantime::format_rfc3339(std::time::SystemTime::now()).to_string();
@@ -1310,7 +1312,7 @@ impl TableAccess for TreeSequence {
13101312
PopulationTable::new_from_table(unsafe { &(*(*self.inner).tables).populations })
13111313
}
13121314

1313-
#[cfg(feature = "provenance")]
1315+
#[cfg(any(feature = "provenance", doc))]
13141316
fn provenances(&self) -> crate::provenance::ProvenanceTable {
13151317
crate::provenance::ProvenanceTable::new_from_table(unsafe {
13161318
&(*(*self.inner).tables).provenances

0 commit comments

Comments
 (0)