Fix more issues identified by clippy (aka: lint).

This commit is contained in:
Gregory Burd 2020-08-07 09:15:36 -04:00
parent 125306e108
commit 4b1583473e
12 changed files with 153 additions and 157 deletions

View file

@ -13,6 +13,8 @@ before_install:
- brew install sqlcipher
rust:
- 1.43.0
- 1.44.0
- 1.45.0
- stable
- beta
- nightly
@ -24,10 +26,10 @@ matrix:
jobs:
include:
- stage: "Test iOS"
rust: 1.43.0
rust: 1.45.0
script: ./scripts/test-ios.sh
- stage: "Docs"
rust: 1.43.0
rust: 1.45.0
script: ./scripts/cargo-doc.sh
script:
- cargo build --verbose --all

View file

@ -29,6 +29,9 @@ members = ["tools/cli", "ffi"]
[build-dependencies]
rustc_version = "~0.2"
[dev-dependencies]
assert_approx_eq = "~1.1"
[dev-dependencies.cargo-husky]
version = "1"
default-features = false # Disable features which are enabled by default

View file

@ -70,6 +70,7 @@
//! (for `Result<(), T>`). Callers are responsible for freeing the `message` field of `ExternError`.
#![allow(unused_doc_comments)]
#![allow(clippy::missing_safety_doc)]
extern crate core;
extern crate libc;
@ -176,8 +177,12 @@ pub unsafe extern "C" fn store_open(uri: *const c_char, error: *mut ExternError)
}
/// Variant of store_open that opens an encrypted database.
///
/// # Safety
/// Be afraid... TODO
///
/// Callers are responsible for managing the memory for the return value.
/// A destructor `store_destroy` is provided for releasing the memory for this
/// pointer type.
#[cfg(feature = "sqlcipher")]
#[no_mangle]
pub unsafe extern "C" fn store_open_encrypted(
@ -249,6 +254,10 @@ pub unsafe extern "C" fn in_progress_transact<'m>(
/// in progress transaction.
///
/// # Safety
/// Callers are responsible for managing the memory for the return value.
/// A destructor `tx_report_destroy` is provided for releasing the memory for this
/// pointer type.
///
/// TODO: Document the errors that can result from transact
#[no_mangle]
pub unsafe extern "C" fn in_progress_commit<'m>(
@ -264,6 +273,11 @@ pub unsafe extern "C" fn in_progress_commit<'m>(
/// in progress transaction.
///
/// # Safety
///
/// Callers are responsible for managing the memory for the return value.
/// A destructor `tx_report_destroy` is provided for releasing the memory for this
/// pointer type.
///
/// TODO: Document the errors that can result from rollback
#[no_mangle]
pub unsafe extern "C" fn in_progress_rollback<'m>(
@ -1360,7 +1374,7 @@ pub unsafe extern "C" fn tx_report_entity_for_temp_id(
let tx_report = &*tx_report;
let key = c_char_to_string(tempid);
if let Some(entid) = tx_report.tempids.get(key) {
Box::into_raw(Box::new(entid.clone() as c_longlong))
Box::into_raw(Box::new(*entid as c_longlong))
} else {
std::ptr::null_mut()
}
@ -2145,7 +2159,7 @@ pub unsafe extern "C" fn store_register_observer(
.map(|(tx_id, changes)| {
(
*tx_id,
changes.into_iter().map(|eid| *eid as c_longlong).collect(),
changes.iter().map(|eid| *eid as c_longlong).collect(),
)
})
.collect();

View file

@ -533,7 +533,7 @@ mod test {
assert_eq!(
results
.get(1)
.map_or(None, |t| t.to_owned().into_long())
.and_then(|t| t.to_owned().into_long())
.expect("long"),
25
);

View file

@ -117,7 +117,7 @@ impl Store {
}
#[cfg(test)]
pub fn is_registered_as_observer(&self, key: &String) -> bool {
pub fn is_registered_as_observer(&self, key: &str) -> bool {
self.conn
.tx_observer_service
.lock()
@ -309,13 +309,11 @@ mod tests {
[?neighborhood :neighborhood/district ?d]
[?d :district/name ?district]]"#;
let hood = "Beacon Hill";
let inputs = QueryInputs::with_value_sequence(vec![(
var!(?hood),
TypedValue::typed_string(hood).into(),
)]);
let inputs =
QueryInputs::with_value_sequence(vec![(var!(?hood), TypedValue::typed_string(hood))]);
let mut prepared = in_progress.q_prepare(query, inputs).expect("prepared");
match &prepared {
&PreparedQuery::Constant {
match prepared {
PreparedQuery::Constant {
select: ref _select,
} => {}
_ => panic!(),
@ -703,8 +701,8 @@ mod tests {
.expect("entid to exist for completion_date")
.into();
let mut registered_attrs = BTreeSet::new();
registered_attrs.insert(name_entid.clone());
registered_attrs.insert(date_entid.clone());
registered_attrs.insert(name_entid);
registered_attrs.insert(date_entid);
let key = "Test Observing".to_string();
@ -749,27 +747,27 @@ mod tests {
let mut in_progress = conn.begin_transaction().expect("expected transaction");
for i in 0..3 {
let mut changeset = BTreeSet::new();
changeset.insert(db_tx_instant_entid.clone());
changeset.insert(db_tx_instant_entid);
let name = format!("todo{}", i);
let uuid = Uuid::new_v4();
let mut builder = in_progress.builder().describe_tempid(&name);
builder
.add(kw!(:todo/uuid), TypedValue::Uuid(uuid))
.expect("Expected added uuid");
changeset.insert(uuid_entid.clone());
changeset.insert(uuid_entid);
builder
.add(kw!(:todo/name), TypedValue::typed_string(name))
.expect("Expected added name");
changeset.insert(name_entid.clone());
changeset.insert(name_entid);
if i % 2 == 0 {
builder
.add(kw!(:todo/completion_date), TypedValue::current_instant())
.expect("Expected added date");
changeset.insert(date_entid.clone());
changeset.insert(date_entid);
}
let (ip, r) = builder.transact();
let report = r.expect("expected a report");
tx_ids.push(report.tx_id.clone());
tx_ids.push(report.tx_id);
changesets.push(changeset);
in_progress = ip;
}
@ -788,7 +786,7 @@ mod tests {
let out = Arc::try_unwrap(output).expect("unwrapped");
let o = out.into_inner().expect("Expected an Output");
assert_eq!(o.called_key, Some(key.clone()));
assert_eq!(o.called_key, Some(key));
assert_eq!(o.txids, tx_ids);
assert_eq!(o.changes, changesets);
}
@ -811,8 +809,8 @@ mod tests {
.expect("entid to exist for completion_date")
.into();
let mut registered_attrs = BTreeSet::new();
registered_attrs.insert(name_entid.clone());
registered_attrs.insert(date_entid.clone());
registered_attrs.insert(name_entid);
registered_attrs.insert(date_entid);
let key = "Test Observing".to_string();

View file

@ -35,6 +35,8 @@ use mentat::conn::Conn;
use public_traits::errors::MentatError;
use assert_approx_eq::assert_approx_eq;
#[test]
fn test_rel() {
let mut c = new_connection("").expect("Couldn't open conn.");
@ -468,7 +470,7 @@ fn test_fulltext() {
) => {
assert_eq!(x, v);
assert_eq!(text.as_str(), "hello darkness my old friend");
assert_eq!(score, 0.0f64);
assert_approx_eq!(score, 0.0f64.into());
}
_ => panic!("Unexpected results."),
}
@ -854,7 +856,7 @@ fn test_type_reqs() {
let eid_query = r#"[:find ?eid :where [?eid :test/string "foo"]]"#;
let res = conn
.q_once(&mut c, eid_query, None)
.q_once(&c, eid_query, None)
.into_rel_result()
.expect("results");

View file

@ -77,7 +77,7 @@ mod tolstoy_tests {
where
T: Iterator<Item = TxPart>,
{
let datoms = self.txes.entry(tx_id).or_insert_with(|| vec![]);
let datoms = self.txes.entry(tx_id).or_default();
datoms.extend(d);
Ok(())
}

View file

@ -799,9 +799,7 @@ fn test_upgrade_with_functions() {
return Ok(());
}
ip.transact_builder(builder)
.and(Ok(()))
.map_err(|e| e.into())
ip.transact_builder(builder).and(Ok(())).map_err(|e| e)
}
/// This is the function we write to dedupe. This logic is very suitable for sharing:
@ -821,50 +819,47 @@ fn test_upgrade_with_functions() {
.into_iter()
{
let mut row = row.into_iter();
match (row.next(), row.next()) {
(
Some(Binding::Scalar(TypedValue::Ref(left))),
Some(Binding::Scalar(TypedValue::Ref(right))),
) => {
let keep = KnownEntid(left);
let replace = KnownEntid(right);
if let (
Some(Binding::Scalar(TypedValue::Ref(left))),
Some(Binding::Scalar(TypedValue::Ref(right))),
) = (row.next(), row.next())
{
let keep = KnownEntid(left);
let replace = KnownEntid(right);
// For each use of the second entity, retract it and re-assert with the first.
// We should offer some support for doing this, 'cos this is long-winded and has
// the unexpected side-effect of also trying to retract metadata about the entity…
println!("Replacing uses of {} to {}.", replace.0, keep.0);
for (a, v) in ip
.q_once(
"[:find ?a ?v
// For each use of the second entity, retract it and re-assert with the first.
// We should offer some support for doing this, 'cos this is long-winded and has
// the unexpected side-effect of also trying to retract metadata about the entity…
println!("Replacing uses of {} to {}.", replace.0, keep.0);
for (a, v) in ip
.q_once(
"[:find ?a ?v
:in ?old
:where [?old ?a ?v]]",
QueryInputs::with_value_sequence(vec![(var!(?old), replace.into())]),
)
.into_rel_result()?
.into_iter()
.map(av)
{
builder.retract(replace, a, v.clone())?;
builder.add(keep, a, v)?;
}
for (e, a) in ip
.q_once(
"[:find ?e ?a
QueryInputs::with_value_sequence(vec![(var!(?old), replace.into())]),
)
.into_rel_result()?
.into_iter()
.map(av)
{
builder.retract(replace, a, v.clone())?;
builder.add(keep, a, v)?;
}
for (e, a) in ip
.q_once(
"[:find ?e ?a
:in ?old
:where [?e ?a ?old]]",
QueryInputs::with_value_sequence(vec![(var!(?old), replace.into())]),
)
.into_rel_result()?
.into_iter()
.map(ea)
{
builder.retract(e, a, replace)?;
builder.add(e, a, keep)?;
}
// TODO: `retractEntity` on `replace` (when we support that).
QueryInputs::with_value_sequence(vec![(var!(?old), replace.into())]),
)
.into_rel_result()?
.into_iter()
.map(ea)
{
builder.retract(e, a, replace)?;
builder.add(e, a, keep)?;
}
_ => {}
// TODO: `retractEntity` on `replace` (when we support that).
}
}
@ -872,9 +867,7 @@ fn test_upgrade_with_functions() {
return Ok(());
}
ip.transact_builder(builder)
.and(Ok(()))
.map_err(|e| e.into())
ip.transact_builder(builder).and(Ok(())).map_err(|e| e)
}
// This migration is bad: it can't impose the uniqueness constraint because we end up with
@ -1150,9 +1143,7 @@ fn test_upgrade_with_functions() {
db_doc,
TypedValue::typed_string("Deprecated. Use :movie/likes or :food/likes instead."),
)?;
ip.transact_builder(builder)
.and(Ok(()))
.map_err(|e| e.into())
ip.transact_builder(builder).and(Ok(())).map_err(|e| e)
}
};

View file

@ -105,26 +105,26 @@ impl Command {
pub fn output(&self) -> String {
match self {
&Command::Cache(ref attr, ref direction) => {
Command::Cache(ref attr, ref direction) => {
format!(".{} {} {:?}", COMMAND_CACHE, attr, direction)
}
&Command::Close => format!(".{}", COMMAND_CLOSE),
&Command::Exit => format!(".{}", COMMAND_EXIT_LONG),
&Command::Help(ref args) => format!(".{} {:?}", COMMAND_HELP, args),
&Command::Import(ref args) => format!(".{} {}", COMMAND_IMPORT_LONG, args),
&Command::Open(ref args) => format!(".{} {}", COMMAND_OPEN, args),
&Command::OpenEncrypted(ref db, ref key) => {
Command::Close => format!(".{}", COMMAND_CLOSE),
Command::Exit => format!(".{}", COMMAND_EXIT_LONG),
Command::Help(ref args) => format!(".{} {:?}", COMMAND_HELP, args),
Command::Import(ref args) => format!(".{} {}", COMMAND_IMPORT_LONG, args),
Command::Open(ref args) => format!(".{} {}", COMMAND_OPEN, args),
Command::OpenEncrypted(ref db, ref key) => {
format!(".{} {} {}", COMMAND_OPEN_ENCRYPTED, db, key)
}
&Command::Query(ref args) => format!(".{} {}", COMMAND_QUERY_LONG, args),
&Command::QueryExplain(ref args) => format!(".{} {}", COMMAND_QUERY_EXPLAIN_LONG, args),
&Command::QueryPrepared(ref args) => {
Command::Query(ref args) => format!(".{} {}", COMMAND_QUERY_LONG, args),
Command::QueryExplain(ref args) => format!(".{} {}", COMMAND_QUERY_EXPLAIN_LONG, args),
Command::QueryPrepared(ref args) => {
format!(".{} {}", COMMAND_QUERY_PREPARED_LONG, args)
}
&Command::Schema => format!(".{}", COMMAND_SCHEMA),
&Command::Sync(ref args) => format!(".{} {:?}", COMMAND_SYNC, args),
&Command::Timer(on) => format!(".{} {}", COMMAND_TIMER_LONG, on),
&Command::Transact(ref args) => format!(".{} {}", COMMAND_TRANSACT_LONG, args),
Command::Schema => format!(".{}", COMMAND_SCHEMA),
Command::Sync(ref args) => format!(".{} {:?}", COMMAND_SYNC, args),
Command::Timer(on) => format!(".{} {}", COMMAND_TIMER_LONG, on),
Command::Transact(ref args) => format!(".{} {}", COMMAND_TRANSACT_LONG, args),
}
}
}
@ -219,7 +219,7 @@ pub fn command(s: &str) -> Result<Command, Error> {
let help_parser = string(COMMAND_HELP)
.with(spaces())
.with(arguments())
.map(|args| Ok(Command::Help(args.clone())));
.map(|args| Ok(Command::Help(args)));
let import_parser = attempt(string(COMMAND_IMPORT_LONG))
.or(attempt(string(COMMAND_IMPORT_SHORT)))
@ -257,7 +257,7 @@ pub fn command(s: &str) -> Result<Command, Error> {
.with(spaces())
.with(arguments())
.map(|args| {
if args.len() < 1 {
if args.is_empty() {
bail!(CliError::CommandParse(
"Missing required argument".to_string()
));
@ -268,7 +268,7 @@ pub fn command(s: &str) -> Result<Command, Error> {
args[2]
)));
}
Ok(Command::Sync(args.clone()))
Ok(Command::Sync(args))
});
let timer_parser = string(COMMAND_TIMER_LONG)
@ -320,7 +320,7 @@ mod tests {
Command::Help(args) => {
assert_eq!(args, vec!["command1", "command2"]);
}
_ => assert!(false),
_ => panic!(),
}
}
@ -332,7 +332,7 @@ mod tests {
Command::Help(args) => {
assert_eq!(args, vec![".command1"]);
}
_ => assert!(false),
_ => panic!(),
}
}
@ -345,7 +345,7 @@ mod tests {
let empty: Vec<String> = vec![];
assert_eq!(args, empty);
}
_ => assert!(false),
_ => panic!(),
}
}
@ -358,7 +358,7 @@ mod tests {
let empty: Vec<String> = vec![];
assert_eq!(args, empty);
}
_ => assert!(false),
_ => panic!(),
}
}
@ -377,7 +377,7 @@ mod tests {
Command::Open(arg) => {
assert_eq!(arg, "database1".to_string());
}
_ => assert!(false),
_ => panic!(),
}
}
@ -389,7 +389,7 @@ mod tests {
Command::Open(arg) => {
assert_eq!(arg, "/path/to/my.db".to_string());
}
_ => assert!(false),
_ => panic!(),
}
}
@ -402,7 +402,7 @@ mod tests {
assert_eq!(path, "/path/to/my.db".to_string());
assert_eq!(key, "hunter2".to_string());
}
_ => assert!(false),
_ => panic!(),
}
}
@ -422,7 +422,7 @@ mod tests {
assert_eq!(args[0], "https://example.com/api/".to_string());
assert_eq!(args[1], "316ea470-ce35-4adf-9c61-e0de6e289c59".to_string());
}
_ => assert!(false),
_ => panic!(),
}
}
@ -434,7 +434,7 @@ mod tests {
Command::Open(arg) => {
assert_eq!(arg, "my.db".to_string());
}
_ => assert!(false),
_ => panic!(),
}
}
@ -463,9 +463,8 @@ mod tests {
fn test_close_parser_no_args() {
let input = ".close";
let cmd = command(&input).expect("Expected close command");
match cmd {
Command::Close => assert!(true),
_ => assert!(false),
if cmd != Command::Close {
panic!()
}
}
@ -473,9 +472,8 @@ mod tests {
fn test_close_parser_no_args_trailing_whitespace() {
let input = ".close ";
let cmd = command(&input).expect("Expected close command");
match cmd {
Command::Close => assert!(true),
_ => assert!(false),
if cmd != Command::Close {
panic!()
}
}
@ -490,9 +488,8 @@ mod tests {
fn test_exit_parser_no_args() {
let input = ".exit";
let cmd = command(&input).expect("Expected exit command");
match cmd {
Command::Exit => assert!(true),
_ => assert!(false),
if cmd != Command::Exit {
panic!()
}
}
@ -500,9 +497,8 @@ mod tests {
fn test_exit_parser_no_args_trailing_whitespace() {
let input = ".exit ";
let cmd = command(&input).expect("Expected exit command");
match cmd {
Command::Exit => assert!(true),
_ => assert!(false),
if cmd != Command::Exit {
panic!()
}
}
@ -510,9 +506,8 @@ mod tests {
fn test_exit_parser_short_command() {
let input = ".e";
let cmd = command(&input).expect("Expected exit command");
match cmd {
Command::Exit => assert!(true),
_ => assert!(false),
if cmd != Command::Exit {
panic!()
}
}
@ -527,9 +522,8 @@ mod tests {
fn test_schema_parser_no_args() {
let input = ".schema";
let cmd = command(&input).expect("Expected schema command");
match cmd {
Command::Schema => assert!(true),
_ => assert!(false),
if cmd != Command::Schema {
panic!()
}
}
@ -537,9 +531,8 @@ mod tests {
fn test_schema_parser_no_args_trailing_whitespace() {
let input = ".schema ";
let cmd = command(&input).expect("Expected schema command");
match cmd {
Command::Schema => assert!(true),
_ => assert!(false),
if cmd != Command::Schema {
panic!()
}
}
@ -549,7 +542,7 @@ mod tests {
let cmd = command(&input).expect("Expected query command");
match cmd {
Command::Query(edn) => assert_eq!(edn, "[:find ?x :where [?x foo/bar ?y]]"),
_ => assert!(false),
_ => panic!(),
}
}
@ -559,7 +552,7 @@ mod tests {
let cmd = command(&input).expect("Expected query command");
match cmd {
Command::Query(edn) => assert_eq!(edn, "[:find ?x :where [?x foo/bar ?y]]"),
_ => assert!(false),
_ => panic!(),
}
}
@ -569,7 +562,7 @@ mod tests {
let cmd = command(&input).expect("Expected query command");
match cmd {
Command::Query(edn) => assert_eq!(edn, "[:find ?x\r\n"),
_ => assert!(false),
_ => panic!(),
}
}
@ -579,7 +572,7 @@ mod tests {
let cmd = command(&input).expect("Expected query command");
match cmd {
Command::Query(edn) => assert_eq!(edn, "{}"),
_ => assert!(false),
_ => panic!(),
}
}
@ -616,7 +609,7 @@ mod tests {
edn,
"[[:db/add \"s\" :db/ident :foo/uuid] [:db/add \"r\" :db/ident :bar/uuid]]"
),
_ => assert!(false),
_ => panic!(),
}
}
@ -630,7 +623,7 @@ mod tests {
edn,
"[[:db/add \"s\" :db/ident :foo/uuid] [:db/add \"r\" :db/ident :bar/uuid]]"
),
_ => assert!(false),
_ => panic!(),
}
}
@ -640,7 +633,7 @@ mod tests {
let cmd = command(&input).expect("Expected transact command");
match cmd {
Command::Transact(edn) => assert_eq!(edn, "{\r\n"),
_ => assert!(false),
_ => panic!(),
}
}
@ -650,7 +643,7 @@ mod tests {
let cmd = command(&input).expect("Expected transact command");
match cmd {
Command::Transact(edn) => assert_eq!(edn, "{}"),
_ => assert!(false),
_ => panic!(),
}
}
@ -672,9 +665,8 @@ mod tests {
fn test_parser_preceeding_trailing_whitespace() {
let input = " .close ";
let cmd = command(&input).expect("Expected close command");
match cmd {
Command::Close => assert!(true),
_ => assert!(false),
if cmd != Command::Close {
panic!()
}
}

View file

@ -130,13 +130,11 @@ impl InputReader {
// Therefore, we add the newly read in line to the existing command args.
// If there is no in process command, we parse the read in line as a new command.
let cmd = match &self.in_process_cmd {
&Some(Command::QueryPrepared(ref args)) => {
Some(Command::QueryPrepared(ref args)) => {
Ok(Command::QueryPrepared(args.clone() + "\n" + &line))
}
&Some(Command::Query(ref args)) => Ok(Command::Query(args.clone() + "\n" + &line)),
&Some(Command::Transact(ref args)) => {
Ok(Command::Transact(args.clone() + "\n" + &line))
}
Some(Command::Query(ref args)) => Ok(Command::Query(args.clone() + "\n" + &line)),
Some(Command::Transact(ref args)) => Ok(Command::Transact(args.clone() + "\n" + &line)),
_ => command(&self.buffer),
};
@ -202,7 +200,7 @@ impl InputReader {
match stdin().read_line(&mut s) {
Ok(0) | Err(_) => UserAction::Quit,
Ok(_) => {
if s.ends_with("\n") {
if s.ends_with('\n') {
let len = s.len() - 1;
s.truncate(len);
}

View file

@ -136,7 +136,7 @@ pub fn run() -> i32 {
.filter_map(|arg| match last_arg {
Some("-d") => {
last_arg = None;
if let &Some(ref k) = &key {
if let Some(ref k) = key {
Some(command_parser::Command::OpenEncrypted(
arg.clone(),
k.clone(),

View file

@ -430,14 +430,10 @@ impl Repl {
}
} else {
for mut arg in args {
if arg.chars().nth(0).unwrap() == '.' {
if arg.starts_with('.') {
arg.remove(0);
}
if let Some(&(cmd, msg)) = HELP_COMMANDS
.iter()
.filter(|&&(c, _)| c == arg.as_str())
.next()
{
if let Some(&(cmd, msg)) = HELP_COMMANDS.iter().find(|&&(c, _)| c == arg.as_str()) {
write!(output, ".{}\t", cmd).unwrap();
writeln!(output, "{}", msg).unwrap();
} else {
@ -569,13 +565,13 @@ impl Repl {
fn binding_as_string(&self, value: &Binding) -> String {
use self::Binding::*;
match value {
&Scalar(ref v) => self.value_as_string(v),
&Map(ref v) => self.map_as_string(v),
&Vec(ref v) => self.vec_as_string(v),
Scalar(ref v) => self.value_as_string(v),
Map(ref v) => self.map_as_string(v),
Vec(ref v) => self.vec_as_string(v),
}
}
fn vec_as_string(&self, value: &Vec<Binding>) -> String {
fn vec_as_string(&self, value: &[Binding]) -> String {
let mut out: String = "[".to_string();
let vals: Vec<String> = value.iter().map(|v| self.binding_as_string(v)).collect();
@ -603,20 +599,20 @@ impl Repl {
fn value_as_string(&self, value: &TypedValue) -> String {
use self::TypedValue::*;
match value {
&Boolean(b) => {
if b {
Boolean(b) => {
if *b {
"true".to_string()
} else {
"false".to_string()
}
}
&Double(d) => format!("{}", d),
&Instant(ref i) => format!("{}", i),
&Keyword(ref k) => format!("{}", k),
&Long(l) => format!("{}", l),
&Ref(r) => format!("{}", r),
&String(ref s) => format!("{:?}", s.to_string()),
&Uuid(ref u) => format!("{}", u),
Double(d) => format!("{}", d),
Instant(ref i) => format!("{}", i),
Keyword(ref k) => format!("{}", k),
Long(l) => format!("{}", l),
Ref(r) => format!("{}", r),
String(ref s) => format!("{:?}", s.to_string()),
Uuid(ref u) => format!("{}", u),
}
}
}