Skip to content

Commit

Permalink
rustfmt tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
contagon committed Jan 7, 2025
1 parent 480fb93 commit 84df588
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/gps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ A simple 2D pose slam example with "GPS" measurements
#![allow(unused_imports)]
// Our state will be represented by SE2 -> theta, x, y
// VectorVar2 is a newtype around Vector2 for optimization purposes
use factrs::variables::{VectorVar2, SE2};
use factrs::{
assign_symbols,
core::{BetweenResidual, GaussNewton, Graph, Values},
dtype, fac,
linalg::{Const, ForwardProp, Numeric, NumericalDiff, VectorX},
residuals::Residual1,
traits::*,
variables::{VectorVar2, SE2},
};

#[derive(Clone, Debug)]
Expand Down
6 changes: 4 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ pub fn load_g20(file: &str) -> (Graph, Values) {
let m22 = parts[9].parse::<dtype>().expect("Failed to parse g20");
let m23 = parts[10].parse::<dtype>().expect("Failed to parse g20");
let m33 = parts[11].parse::<dtype>().expect("Failed to parse g20");
// Note have to permute here - g2o stores with translation first, factrs with rotation first
// Note have to permute here - g2o stores with translation first, factrs with
// rotation first
#[rustfmt::skip]
let inf = Matrix3::new(
m33, m13, m23,
Expand Down Expand Up @@ -135,7 +136,8 @@ pub fn load_g20(file: &str) -> (Graph, Values) {
let m55 = parts[28].parse::<dtype>().expect("Failed to parse g20");
let m56 = parts[29].parse::<dtype>().expect("Failed to parse g20");
let m66 = parts[30].parse::<dtype>().expect("Failed to parse g20");
// Note have to permute here - g2o stores with translation first, factrs with rotation first
// Note have to permute here - g2o stores with translation first, factrs with
// rotation first
#[rustfmt::skip]
let inf = Matrix6::new(
m44, m45, m46, m14, m24, m34,
Expand Down
6 changes: 3 additions & 3 deletions src/variables/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ pub trait Variable: Clone + Sized + Display + Debug {
other.inverse().compose(self)
}

// TODO: This function is kind of ugly functions still
// Would be nice if it wasn't a static function, but I couldn't ever get it quite right
// Tried to add bound Self: Variable<T = DualVector<N>>, but it then I couldn't do custom impl
// TODO: This function is kind of ugly still
// It'd be nice if it used the dtype of the type itself instead of making a
// dtype with a generic

/// Setup group element correctly using the tangent space
///
Expand Down
3 changes: 2 additions & 1 deletion tests/custom_variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ factrs::test_variable!(MyVar);

#[cfg(feature = "serde")]
mod ser_de {
use super::*;
use factrs::{
assert_variable_eq, containers::Values, residuals::PriorResidual, symbols::X,
traits::Residual, variables::VariableSafe,
};

use super::*;

// Make sure it serializes properly
#[test]
fn test_json_serialize() {
Expand Down

0 comments on commit 84df588

Please sign in to comment.