Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: clearer doc for list metakey #3666

Merged
merged 4 commits into from
Nov 30, 2023
Merged

Conversation

wcy-fdu
Copy link
Contributor

@wcy-fdu wcy-fdu commented Nov 24, 2023

馃挦馃挦馃挦

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better not to touch our upgrade.md. How about polish our list_with && lister_with API docs instead?

@wcy-fdu wcy-fdu requested a review from Xuanwo November 27, 2023 01:59
core/src/types/list.rs Outdated Show resolved Hide resolved
@Xuanwo
Copy link
Member

Xuanwo commented Nov 27, 2023

CI failed for doctest failed:

failures:

---- core/src/types/list.rs - types::list::Lister (line 40) stdout ----
error[E0412]: cannot find type `Entry` in this scope
 --> core/src/types/list.rs:41:18
  |
3 | let entries: Vec<Entry> = op
  |                  ^^^^^ not found in this scope
  |
help: consider importing one of these items
  |
2 + use http::header::Entry;
  |
2 + use opendal::Entry;
  |
2 + use opendal::raw::oio::Entry;
  |
2 + use reqwest::header::Entry;
  |
    and 3 other candidates

error[E0425]: cannot find value `op` in this scope
 --> core/src/types/list.rs:41:27
  |
3 | let entries: Vec<Entry> = op
  |                           ^^ not found in this scope

error[E0433]: failed to resolve: use of undeclared type `Metakey`
 --> core/src/types/list.rs:43:11
  |
5 |  .metakey(Metakey::ContentLength).await?;
  |           ^^^^^^^ use of undeclared type `Metakey`
  |
help: consider importing this enum
  |
2 + use opendal::Metakey;
  |

error[E0425]: cannot find value `entris` in this scope
 --> core/src/types/list.rs:44:14
  |
6 | for entry in entris {
  |              ^^^^^^ help: a local variable with a similar name exists: `entries`

error[E0728]: `await` is only allowed inside `async` functions and blocks
 --> core/src/types/list.rs:43:35
  |
2 | fn main() { #[allow(non_snake_case)] fn _doctest_main_core_src_types_list_rs_40_0() {
  |                                         ----------------------------------------- this is not `async`
...
5 |  .metakey(Metakey::ContentLength).await?;
  |                                   ^^^^^ only allowed inside `async` functions and blocks

error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
 --> core/src/types/list.rs:43:40
  |
2 | fn main() { #[allow(non_snake_case)] fn _doctest_main_core_src_types_list_rs_40_0() {
  |                                      ---------------------------------------------- this function should return `Result` or `Option` to accept `?`
...
5 |  .metakey(Metakey::ContentLength).await?;
  |                                        ^ cannot use the `?` operator in a function that returns `()`
  |
  = help: the trait `FromResidual<_>` is not implemented for `()`

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0277, E0412, E0425, E0433, E0728.
For more information about an error, try `rustc --explain E0277`.
Couldn't compile the test.

failures:
    core/src/types/list.rs - types::list::Lister (line 40)

test result: FAILED. 111 passed; 1 failed; 8 ignored; 0 measured; 0 filtered out; finished in 37.97s

You can reproduce locally by running cargo test --doc

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Xuanwo Xuanwo merged commit fb4b8ea into apache:main Nov 30, 2023
171 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants