Skip to content
This repository was archived by the owner on Sep 28, 2020. It is now read-only.

statics: Remove unneeded (and kinda odd) static str's#2

Merged
mibes merged 1 commit into
mibes:masterfrom
kallisti5:fix-statics
Sep 11, 2020
Merged

statics: Remove unneeded (and kinda odd) static str's#2
mibes merged 1 commit into
mibes:masterfrom
kallisti5:fix-statics

Conversation

@kallisti5

Copy link
Copy Markdown
  • These make non-static str database names ackward to use

* These make non-static str database names ackward to use
@kallisti5

Copy link
Copy Markdown
Author

congrats!

66Origin doesn't seem interested in maintaining Sofa, so you get my PR's ;-)

Had a quick discussion in rust channels about this.. these static str's are really weird, and add a ton of un-needed complexity around non static (aka non- "databasename") values.

Here's an example common error:

error[E0759]: cannot infer an appropriate lifetime
--> src/deploymentdb/mod.rs:5:19
|
5 | pub async fn open(name: &str)
|                   ^^^^  ---- this data with an anonymous lifetime `'_`...
|                   |
|                   ...is captured here...
...
8 |     client.db(name.clone()).await
|               ------------ ...and is required to live as long as `'static` here

@kallisti5

Copy link
Copy Markdown
Author
    Finished test [unoptimized + debuginfo] target(s) in 6.97s
     Running target/debug/deps/sofa-9dc88c2fa70911b4

running 13 tests
test sofa_tests::a_sys::a_should_check_couchdbs_status ... ok
test sofa_tests::a_sys::b_should_create_sofa_test_db ... ok
test sofa_tests::a_sys::c_should_create_a_document ... ok
test sofa_tests::a_sys::d_should_destroy_the_db ... ok
test sofa_tests::b_db::a_should_update_a_document ... ok
test sofa_tests::b_db::b_should_remove_a_document ... ok
test sofa_tests::b_db::c_should_get_a_single_document ... ok
test sofa_tests::b_db::d_should_create_index_in_db ... ok
test sofa_tests::b_db::e_should_list_indexes_in_db ... ok
test sofa_tests::b_db::f_should_ensure_index_in_db ... ok
test sofa_tests::b_db::g_should_find_documents_in_db ... ok
test sofa_tests::b_db::h_should_bulk_get_a_document ... ok
test sofa_tests::b_db::i_should_bulk_get_invalid_documents ... ok

test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

   Doc-tests sofa

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

@mibes404

Copy link
Copy Markdown

Sorry this took a while, but I agree that these are a bit awkward. Let me merge this request.

@mibes mibes merged commit 6198744 into mibes:master Sep 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants