Skip to content

Commit

Permalink
ci: enforce cargo fmt lint check, ran cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Mar 24, 2020
1 parent 1ceb9c9 commit 3545fdd
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ jobs:
toolchain: nightly
components: clippy, rustfmt
override: true
- name: Check formatting # Doesn't fail build
run: cargo fmt -- --check || true
- name: Check formatting
if: always()
run: cargo fmt -- --check
- name: Run clippy # Doesn't fail build
if: always()
run: cargo clippy
2 changes: 1 addition & 1 deletion aw-client-rust/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mod test {
match client.get_info() {
Ok(_) => break,
Err(err) => {
if i == timeout_s-1 {
if i == timeout_s - 1 {
panic!(
"Timed out starting aw-server after {}s: {:?}",
timeout_s, err
Expand Down
6 changes: 3 additions & 3 deletions aw-models/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ impl Event {

impl PartialEq for Event {
fn eq(&self, other: &Event) -> bool {
!(self.timestamp != other.timestamp ||
self.duration != other.duration ||
self.data != other.data)
!(self.timestamp != other.timestamp
|| self.duration != other.duration
|| self.data != other.data)
}
}

Expand Down
5 changes: 1 addition & 4 deletions aw-models/src/timeinterval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ pub enum TimeIntervalError {

impl TimeInterval {
pub fn new(start: DateTime<Utc>, end: DateTime<Utc>) -> TimeInterval {
TimeInterval {
start,
end,
}
TimeInterval { start, end }
}

pub fn new_from_string(period: &str) -> Result<TimeInterval, TimeIntervalError> {
Expand Down
4 changes: 2 additions & 2 deletions aw-query/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ mod qfunctions {
) -> Result<DataType, QueryError> {
// typecheck
validate::args_length(&args, 2)?;
let events : Vec<Event> = (&args[0]).try_into()?;
let filter_events : Vec<Event> = (&args[1]).try_into()?;
let events: Vec<Event> = (&args[0]).try_into()?;
let filter_events: Vec<Event> = (&args[1]).try_into()?;

let mut filtered_events = aw_transform::filter_period_intersect(&events, &filter_events);
let mut filtered_tagged_events = Vec::new();
Expand Down
4 changes: 1 addition & 3 deletions aw-transform/src/classify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ impl RuleTrait for RegexRule {
.data
.values()
.filter(|val| val.is_string())
.any(|val| {
self.regex.is_match(val.as_str().unwrap())
})
.any(|val| self.regex.is_match(val.as_str().unwrap()))
}
}

Expand Down

0 comments on commit 3545fdd

Please sign in to comment.