Skip to content

Commit

Permalink
Fix cargo docs warnings and fix building on docsrs
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherRabotin committed Sep 7, 2024
1 parent 0f0d79e commit c9091c6
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ jobs:
cd anise # Build only the Rust library
cargo build --features embed_ephem
cargo build --features embed_ephem --release
# Clean up the data folder as if we were on docsrs
cp data/.cargokeep .
rm -rf data/
mkdir data && mv .cargokeep data/.cargokeep
cargo doc --features embed_ephem
lints:
name: Lints
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ exclude = [
".vscode",
"*.sh",
]
include = ["data/.cargokeep"]

[workspace.dependencies]
hifitime = "4.0.0-alpha"
Expand Down
2 changes: 1 addition & 1 deletion anise/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn main() {

// Create the directory if it doesn't exist
if !data_path.exists() {
if let Err(e) = fs::create_dir_all(&data_path) {
if fs::create_dir_all(&data_path).is_err() {
eprintln!("EMBEDDED EPHEM UNAVAILABLE: failed to create directory {data_path:?}");
// Try nothing else.
return;
Expand Down
2 changes: 1 addition & 1 deletion anise/src/almanac/embed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct AstroData;
impl Almanac {
/// Provides planetary ephemerides from 2024-01-01 until 2035-01-01. Also provides planetary constants data (from the PCK11 kernel).
///
/// Until https://github.com/nyx-space/anise/issues/269, this will provide 100 years of data
/// Until <https://github.com/nyx-space/anise/issues/269>, this will provide 100 years of data
pub fn until_2035() -> AlmanacResult<Self> {
// Regularly refer to https://github.com/nyx-space/anise/blob/master/data/ci_config.dhall for the latest CRC, although it should not change between minor versions!
let pck11 = AstroData::get("pck11.pca").ok_or(AlmanacError::GenericError {
Expand Down
2 changes: 1 addition & 1 deletion anise/src/almanac/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub mod metaload;
mod python;

#[cfg(feature = "embed_ephem")]
#[cfg_attr(docrs, doc(cfg(feature = "embed_ephem")))]
#[cfg_attr(docsrs, doc(cfg(feature = "embed_ephem")))]
mod embed;

#[cfg(feature = "python")]
Expand Down
2 changes: 1 addition & 1 deletion anise/src/almanac/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl Almanac {

/// Alias fo SPICE's `spkezr` where the inputs must be the NAIF IDs of the objects and frames with the caveat that the aberration is moved to the last positional argument.
///
pub fn spkezr(
pub fn spk_ezr(
&self,
target: NaifId,
epoch: Epoch,
Expand Down
2 changes: 1 addition & 1 deletion anise/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ pub mod orientations {
pub const J2000_TO_ECLIPJ2000_ANGLE_RAD: f64 = 0.40909280422232897;

/// Given the frame ID, try to return a human name
/// Source: // https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/frames.html#Appendix.%20%60%60Built%20in''%20Inertial%20Reference%20Frames
/// Source: <https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/frames.html#Appendix.%20%60%60Built%20in''%20Inertial%20Reference%20Frames>
pub const fn orientation_name_from_id(id: NaifId) -> Option<&'static str> {
match id {
J2000 => Some("J2000"),
Expand Down
2 changes: 1 addition & 1 deletion anise/src/structure/lookuptable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub enum LutError {
InvalidIndex { index: u32 },
}

/// A LookUpTable allows finding the [Entry] associated with either an ID or a name.
/// A LookUpTable allows finding the [u32] ("NaifId") associated with either an ID or a name.
///
/// # Note
/// _Both_ the IDs and the name MUST be unique in the look up table.
Expand Down
2 changes: 1 addition & 1 deletion anise/src/structure/planetocentric/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub const MAX_NUT_PREC_ANGLES: usize = 32;
/// ANISE supports two different kinds of orientation data. High precision, with spline based interpolations, and constants right ascension, declination, and prime meridian, typically used for planetary constant data.
///
/// # Documentation of rotation angles
/// Source: https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/pck.html#Models%20for%20the%20Sun,%20Planets,%20and%20some%20Minor%20Bodies%20in%20Text%20PCK%20Kernels
/// Source: <https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/pck.html#Models%20for%20the%20Sun,%20Planets,%20and%20some%20Minor%20Bodies%20in%20Text%20PCK%20Kernels>
/// The angles RA, DEC, and W are defined as follows:
///
/// ```text
Expand Down
2 changes: 1 addition & 1 deletion anise/tests/ephemerides/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ fn de440s_transform_verif_venus2emb() {
spice::unload(spk_path);

// Finally, check that ANISE's SPKEZR works as expected.
let state_ezr = almanac.spkezr(EARTH, epoch, ITRF93, VENUS, None).unwrap();
let state_ezr = almanac.spk_ezr(EARTH, epoch, ITRF93, VENUS, None).unwrap();
assert_eq!(state_ezr, state_rtn);
}

Expand Down
1 change: 1 addition & 0 deletions data/.cargokeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Required in cargo for documenting the embed_ephem feature

0 comments on commit c9091c6

Please sign in to comment.