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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make open/create/builder accept &PathBuf and others #49

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

DrSensor
Copy link
Contributor

@DrSensor DrSensor commented Jan 9, 2024

Choose one: is this a 🐛 bug fix, a 🙋 feature, or a 🔦 documentation change?
🙋 feature

Checklist

  • tests pass

Context

I'm building lsp-proxy and happen to found this crate (thankyou), and this has been bugging me

async fn did_open(&self, params: DidOpenTextDocumentParams) {
  let path = Path::new(params.text_document.uri.path());
  let file = RandomAccess::open(path.clone().into());
  // using `path` for something else
}

This change avoid the need for clone() by using &path.
It also mirror to std::fs::File::open<P: AsRef<Path>>(path: P).

Semver Changes

3.1.0

@ttiurani
Copy link
Member

ttiurani commented Jan 9, 2024

Thanks for this, this is an obvious improvement! I quickly tested compilation with downstream projects too, and doesn't seem to cause any issues.

I'll merge and release 3.0.1 right away so I don't forget about it.

@ttiurani ttiurani merged commit bfabf67 into datrs:master Jan 9, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants