title: Are forward-slashes in `PathBuf::from("dir1/dir2/dir3")` cross-platform-OK?
body: <p>In writing platform-agnostic Rust code, are slashes for directory separators OK:</p>
  <p><code>let path = PathBuf::from(&quot;dir1/dir2/file&quot;)</code></p>
  <p>or is it better to use:</p>
  <p><code>let path: PathBuf = [&quot;dir1&quot;, &quot;dir2&quot;, &quot;file&quot;].iter().collect();</code></p>
  <p>I don't have a Windows system to test on, but if we have to support Windows in future I don't want to have to go back and fix all the slashes. I don't know what will happen with <code>PathBuf::from(&quot;dir1/dir2/file&quot;)</code> on Windows: will something convert to backslashes?</p>
  <p>Both styles seem present in the docs: <a href="https://doc.rust-lang.org/std/path/index.html#simple-usage" rel="nofollow noreferrer">https://doc.rust-lang.org/std/path/index.html#simple-usage</a></p>