Rename the helpful variant, AttributeBuilder::new, to AttributeBuilder::helpful. (#625) r=nalexander

This commit is contained in:
Richard Newman 2018-04-03 14:23:20 -07:00 committed by GitHub
parent ca451a7c9c
commit 9cc5cbf288
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View file

@ -84,7 +84,7 @@ pub struct AttributeBuilder {
impl AttributeBuilder { impl AttributeBuilder {
/// Make a new AttributeBuilder for human consumption: it will help you /// Make a new AttributeBuilder for human consumption: it will help you
/// by flipping relevant flags. /// by flipping relevant flags.
pub fn new() -> Self { pub fn helpful() -> Self {
AttributeBuilder { AttributeBuilder {
helpful: true, helpful: true,
..Default::default() ..Default::default()

View file

@ -1511,25 +1511,25 @@ mod tests {
version: 1, version: 1,
attributes: vec![ attributes: vec![
(kw!(:todo/uuid), (kw!(:todo/uuid),
AttributeBuilder::new() AttributeBuilder::helpful()
.value_type(ValueType::Uuid) .value_type(ValueType::Uuid)
.multival(false) .multival(false)
.unique(Unique::Value) .unique(Unique::Value)
.index(true) .index(true)
.build()), .build()),
(kw!(:todo/name), (kw!(:todo/name),
AttributeBuilder::new() AttributeBuilder::helpful()
.value_type(ValueType::String) .value_type(ValueType::String)
.multival(false) .multival(false)
.fulltext(true) .fulltext(true)
.build()), .build()),
(kw!(:todo/completion_date), (kw!(:todo/completion_date),
AttributeBuilder::new() AttributeBuilder::helpful()
.value_type(ValueType::Instant) .value_type(ValueType::Instant)
.multival(false) .multival(false)
.build()), .build()),
(kw!(:label/name), (kw!(:label/name),
AttributeBuilder::new() AttributeBuilder::helpful()
.value_type(ValueType::String) .value_type(ValueType::String)
.multival(false) .multival(false)
.unique(Unique::Value) .unique(Unique::Value)
@ -1537,7 +1537,7 @@ mod tests {
.index(true) .index(true)
.build()), .build()),
(kw!(:label/color), (kw!(:label/color),
AttributeBuilder::new() AttributeBuilder::helpful()
.value_type(ValueType::String) .value_type(ValueType::String)
.multival(false) .multival(false)
.build()), .build()),

View file

@ -66,7 +66,7 @@
//! version: 1, //! version: 1,
//! attributes: vec![ //! attributes: vec![
//! (kw!(:link/title), //! (kw!(:link/title),
//! vocabulary::AttributeBuilder::new() //! vocabulary::AttributeBuilder::helpful()
//! .value_type(ValueType::String) //! .value_type(ValueType::String)
//! .multival(false) //! .multival(false)
//! .fulltext(true) //! .fulltext(true)

View file

@ -64,13 +64,13 @@ lazy_static! {
version: 1, version: 1,
attributes: vec![ attributes: vec![
(FOO_NAME.clone(), (FOO_NAME.clone(),
vocabulary::AttributeBuilder::new() vocabulary::AttributeBuilder::helpful()
.value_type(ValueType::String) .value_type(ValueType::String)
.multival(false) .multival(false)
.unique(vocabulary::attribute::Unique::Identity) .unique(vocabulary::attribute::Unique::Identity)
.build()), .build()),
(FOO_MOMENT.clone(), (FOO_MOMENT.clone(),
vocabulary::AttributeBuilder::new() vocabulary::AttributeBuilder::helpful()
.value_type(ValueType::Instant) .value_type(ValueType::Instant)
.multival(false) .multival(false)
.index(true) .index(true)
@ -131,7 +131,7 @@ fn test_default_attributebuilder_complains() {
.validate(|| "Foo".to_string()) .validate(|| "Foo".to_string())
.is_err()); .is_err());
assert!(vocabulary::AttributeBuilder::new() assert!(vocabulary::AttributeBuilder::helpful()
.value_type(ValueType::String) .value_type(ValueType::String)
.multival(true) .multival(true)
.fulltext(true) .fulltext(true)
@ -142,12 +142,12 @@ fn test_default_attributebuilder_complains() {
#[test] #[test]
fn test_add_vocab() { fn test_add_vocab() {
let bar = vocabulary::AttributeBuilder::new() let bar = vocabulary::AttributeBuilder::helpful()
.value_type(ValueType::Instant) .value_type(ValueType::Instant)
.multival(false) .multival(false)
.index(true) .index(true)
.build(); .build();
let baz = vocabulary::AttributeBuilder::new() let baz = vocabulary::AttributeBuilder::helpful()
.value_type(ValueType::String) .value_type(ValueType::String)
.multival(true) .multival(true)
.fulltext(true) .fulltext(true)