Skip to content

Commit

Permalink
Apply RustFmt and Clippy recommended changes
Browse files Browse the repository at this point in the history
In order to make the CI work, we need to comply with RustFmt and Clippy
rules.
  • Loading branch information
luismiramirez committed Sep 17, 2021
1 parent a68b071 commit 40d5b1d
Show file tree
Hide file tree
Showing 6 changed files with 539 additions and 372 deletions.
13 changes: 9 additions & 4 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,23 @@ agent:
blocks:
- name: 'Default'
task:
prologue:
commands:
- checkout
- export LOCK_CHECKSUM=$(checksum Cargo.lock)
- ( cd /usr/local && cache restore cargo-${SEMAPHORE_GIT_BRANCH}-${LOCK_CHECKSUM} )
jobs:
- name: Formatter and linter
commands:
- checkout
- rustup component add rustfmt clippy
- cache restore clippy-${SEMAPHORE_GIT_BRANCH}-${LOCK_CHECKSUM}
- cargo fmt --verbose --all -- --check
- cargo clippy
- cache store clippy-${SEMAPHORE_GIT_BRANCH}-${LOCK_CHECKSUM}
- cache store clippy-${SEMAPHORE_GIT_BRANCH}-${LOCK_CHECKSUM} target
- name: Build and tests
commands:
- checkout
- cache restore target-${SEMAPHORE_GIT_BRANCH}-${LOCK_CHECKSUM}
- rustup toolchain install nightly
- cargo build --verbose
- cargo +nightly test --verbose
- ( cd /usr/local && cache store cargo-${SEMAPHORE_GIT_BRANCH}-${LOCK_CHECKSUM} cargo )
- cache store target-${SEMAPHORE_GIT_BRANCH}-${LOCK_CHECKSUM} target
8 changes: 4 additions & 4 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
extern crate sql_lexer;

use std::env;
use std::io::prelude::*;
use std::fs::File;
use std::io::prelude::*;

use sql_lexer::*;

fn main() {
match env::args().skip(1).next() {
match env::args().nth(1) {
Some(arg) => {
let mut file = File::open(arg.as_str()).unwrap();
let mut contents = String::new();
file.read_to_string(&mut contents).unwrap();
println!("{}", sanitize_string(contents));
},
None => println!("Please supply a path to a file containing SQL")
}
None => println!("Please supply a path to a file containing SQL"),
}
}

0 comments on commit 40d5b1d

Please sign in to comment.