Skip to content

Commit

Permalink
Merge pull request AlexPikalov#73 from harrydevnull/master
Browse files Browse the repository at this point in the history
cargo fmt is done
  • Loading branch information
AlexPikalov committed Feb 8, 2017
2 parents df2b83f + 324fd49 commit 24eaadc
Show file tree
Hide file tree
Showing 45 changed files with 1,170 additions and 1,049 deletions.
15 changes: 9 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: rust
cache: cargo
rust:
- stable
- beta
Expand All @@ -7,9 +8,6 @@ matrix:
allow_failures:
- rust: nightly

#before_install:
#- sudo sh -c "echo 'JVM_OPTS=\"\${JVM_OPTS} -Djava.net.preferIPv4Stack=false\"' >> /usr/local/cassandra/conf/cassandra-env.sh"
#- sudo service cassandra start

before_install:
- sudo update-java-alternatives -s java-8-oracle
Expand All @@ -21,9 +19,14 @@ before_install:
- sleep 20


#services:
#- cassandra
install:
- (cargo install rustfmt || true)
- PATH=$PATH:/home/travis/.cargo/bin

script:
- cargo fmt -- --write-mode=diff
- cargo build --verbose
- cargo test --verbose

addons:
apt:
Expand All @@ -39,7 +42,7 @@ addons:
- oracle-java8-installer



after_success:
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
tar xzf master.tar.gz &&
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
[![crates.io version](https://img.shields.io/crates/v/cdrs.svg)](https://crates.io/crates/cdrs)

[![Coverage Status](https://coveralls.io/repos/github/harrydevnull/cdrs/badge.svg?branch=master)](https://coveralls.io/github/harrydevnull/cdrs?branch=master)
[![codecov](https://codecov.io/gh/harrydevnull/cdrs/branch/master/graph/badge.svg)](https://codecov.io/gh/harrydevnull/cdrs)


**CDRS** is a native Cassandra driver written in [Rust](https://www.rust-lang.org).
The motivation to write it in Rust is a lack of native one.
Expand Down Expand Up @@ -420,8 +422,9 @@ Please refer to each project's style guidelines and guidelines for submitting pa
1. **Fork** the repo on GitHub
2. **Clone** the project to your own machine
3. **Commit** changes to your own branch
4. **Push** your work back up to your fork
5. Submit a **Pull request** so that we can review your changes
4. **Run ```cargo test --all-features && cargo fmt -- --write-mode=diff```
5. **Push** your work back up to your fork
6. Submit a **Pull request** so that we can review your changes

NOTE: Be sure to merge the latest from "upstream" before making a pull request!
while running the tests you might need a local cassandra server working.
Expand Down
1 change: 0 additions & 1 deletion examples/batch_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ fn main() {

println!("batch result {:?}", batched.get_body());
}

2 changes: 1 addition & 1 deletion examples/create_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ fn main() {

match session.query(create_table_query, with_tracing, with_warnings) {
Ok(ref res) => println!("table created: {:?}", res.get_body()),
Err(ref err) => println!("Error occured: {:?}", err)
Err(ref err) => println!("Error occured: {:?}", err),
}
}
1 change: 0 additions & 1 deletion examples/prepare_execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@ fn main() {

println!("executed:\n{:?}", executed);
}

1 change: 0 additions & 1 deletion examples/read_table_into_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,3 @@ fn main() {
}

}

10 changes: 2 additions & 8 deletions examples/server_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ use std::thread;
use cdrs::client::CDRS;
use cdrs::authenticators::PasswordAuthenticator;
use cdrs::compression::Compression;
use cdrs::frame::events::{
SimpleServerEvent,
ServerEvent,
TopologyChangeType
};
use cdrs::frame::events::{SimpleServerEvent, ServerEvent, TopologyChangeType};
use cdrs::transport::TransportPlain;

// default credentials
Expand All @@ -27,9 +23,7 @@ fn main() {

let (mut listener, stream) = session.listen_for(vec![SimpleServerEvent::SchemaChange]).unwrap();

thread::spawn(move|| {
listener.start(&Compression::None).unwrap()
});
thread::spawn(move || listener.start(&Compression::None).unwrap());

let topology_changes = stream
// inspects all events in a stream
Expand Down
18 changes: 9 additions & 9 deletions examples/simple_with_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ fn main() {
let with_warnings = false;
let query_op = session.query(select_query, with_tracing, with_warnings);

match query_op {

Ok(res) => {
println!("Result frame: {:?},\nparsed body: {:?}",
res,
res.get_body())
}
Err(err) => println!("{:?}", err),
}
match query_op {

Ok(res) => {
println!("Result frame: {:?},\nparsed body: {:?}",
res,
res.get_body())
}
Err(err) => println!("{:?}", err),
}

}
Err(err) => println!("{:?}", err),
Expand Down
8 changes: 4 additions & 4 deletions src/authenticators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ pub trait Authenticator: Clone {
#[derive(Debug, Clone)]
pub struct PasswordAuthenticator<'a> {
username: &'a str,
password: &'a str
password: &'a str,
}

impl<'a> PasswordAuthenticator<'a> {
pub fn new<'b>(username: &'b str, password: &'b str) -> PasswordAuthenticator<'b> {
return PasswordAuthenticator {
username: username,
password: password
password: password,
};
}
}
Expand Down Expand Up @@ -47,7 +47,6 @@ impl Authenticator for NoneAuthenticator {
fn get_cassandra_name(&self) -> Option<&str> {
return None;
}

}


Expand All @@ -69,7 +68,8 @@ mod tests {
#[test]
fn test_password_authenticator_get_cassandra_name() {
let auth = PasswordAuthenticator::new("foo", "bar");
assert_eq!(auth.get_cassandra_name(), Some("org.apache.cassandra.auth.PasswordAuthenticator"));
assert_eq!(auth.get_cassandra_name(),
Some("org.apache.cassandra.auth.PasswordAuthenticator"));
}

#[test]
Expand Down
Loading

0 comments on commit 24eaadc

Please sign in to comment.