id stringlengths 20 30 | source stringclasses 1
value | chunk_index int64 0 520k | token_count int32 154 512 | content stringlengths 185 57.5k |
|---|---|---|---|---|
rust_dataset_chunk_508900 | rust_dataset.txt | 508,900 | 512 | entirely
fn update_outside_render(entity: &Entity<Counter>, cx: &mut App) {
entity.update(cx, |counter, _cx| {
counter.value += 1;
});
}
// .update() on a non-gpui type (unrelated method named "update")
struct FakeEntity;
impl FakeEntity {
fn update(&self) {}
}
struct FakeView {
thing: FakeE... |
rust_dataset_chunk_508901 | rust_dataset.txt | 508,901 | 512 |
}
}
}
fn btree_map_if_let(map: &mut BTreeMap<String, usize>, key: String) -> usize {
if let Some(value) = map.get(&key) {
*value
} else {
map.insert(key, 1);
1
}
}
// Fix: `map.entry(key).and_modify(|value| *value += 1).or_insert(1)`.
fn btree_map_get_mut(map: &mut BTr... |
rust_dataset_chunk_508902 | rust_dataset.txt | 508,902 | 512 | usize {
let Some(value) = map.get(&key) else {
map.insert(key, 1);
return 1;
};
*value
}
fn expensive() -> usize {
42
}
// Fix: `map.entry(key).or_insert_with(expensive)`.
fn fix_with_or_insert_with(map: &mut HashMap<String, usize>, key: String) {
match map.get(&key) {
Som... |
rust_dataset_chunk_508903 | rust_dataset.txt | 508,903 | 512 | _, String, usize> {
unimplemented!()
}
}
// Clippy's `unnecessary_get_then_check` only covers the std collections, so
// the `get(..).is_none()` form on a third-party map is still ours to catch.
fn entry_compatible_custom_map(map: &mut EntryMap, key: String) {
if map.get(&key).is_none() {
map.i... |
rust_dataset_chunk_508904 | rust_dataset.txt | 508,904 | 512 | Some(_) => {}
None => {
map.insert((*key).clone(), 1);
}
}
}
// An immutable local alias of the cloned key is still the same key.
fn insert_through_alias(map: &mut HashMap<String, usize>, key: String) {
let owned = key.clone();
match map.get(&key) {
Some(_) => {}... |
rust_dataset_chunk_508905 | rust_dataset.txt | 508,905 | 512 | : String) {
map.entry(key).or_insert(1);
}
fn already_uses_entry_or_insert_with(map: &mut HashMap<String, usize>, key: String) {
map.entry(key).or_insert_with(expensive);
}
fn already_uses_entry_or_insert_with_key(map: &mut HashMap<String, usize>, key: String) {
map.entry(key).or_insert_with_key(|key| key... |
rust_dataset_chunk_508906 | rust_dataset.txt | 508,906 | 512 | _contains_or_insert` lint.
fn clippy_handles_set_contains(set: &mut HashSet<String>, value: String) {
if !set.contains(&value) {
set.insert(value);
}
}
// A bare `insert` already searches only once.
fn set_insert_alone(set: &mut HashSet<String>, value: String) -> bool {
set.insert(value)
}
fn btre... |
rust_dataset_chunk_508907 | rust_dataset.txt | 508,907 | 512 | match global_map().get(&key) {
Some(_) => {}
None => {
global_map().insert(key, 1);
}
}
}
// Conversions are peeled by definition, not by name: `DisguisedKey`'s
// inherent `clone` and `to_owned` are not `Clone::clone`/`ToOwned::to_owned`
// and may return a different key.
#... |
rust_dataset_chunk_508908 | rust_dataset.txt | 508,908 | 512 | => {}
None => {
map.insert(id.to_string(), 1);
}
}
}
// Alias resolution must not equate structurally equal but side-effecting
// initializers: the two `next_key()` calls produce two different keys.
fn aliases_of_two_generated_keys(map: &mut HashMap<String, usize>) {
let first = ne... |
rust_dataset_chunk_508909 | rust_dataset.txt | 508,909 | 512 | = Rc::from("world");
let _ok3: Cow<'_, str> = Cow::Borrowed("borrowed");
// Producing a plain `String` (not a refcounted destination).
let _ok4: String = String::from("not refcounted");
let _ok5: String = "x".to_string();
let _ok6: String = "x".to_owned();
// `.into()` from a non-literal `Str... |
rust_dataset_chunk_508910 | rust_dataset.txt | 508,910 | 512 | DATA_";
/// The version number for the data returned from the test metadata function.
/// Increment on non-backwards-compatible changes.
pub const MDATA_VER: u32 = 0;
/// The default weight, if none is specified.
pub const WEIGHT_DEFAULT: u8 = 50;
/// How long a test must have run to be assumed ... |
rust_dataset_chunk_508911 | rust_dataset.txt | 508,911 | 512 | y => f.write_str("iffy"),
Importance::Fluff => f.write_str("fluff"),
}
}
}
/// Why or when did this test fail?
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum FailKind {
/// Failed while triaging it to determine the iteration count.
Triage,
/// Failed while profiling it.
... |
rust_dataset_chunk_508912 | rust_dataset.txt | 508,912 | 512 | )]
pub struct Timings {
/// Mean runtime for `self.iter_total` runs of this test.
pub mean: Duration,
/// Standard deviation for the above.
pub stddev: Duration,
}
impl Timings {
/// How many iterations does this test seem to do per second?
#[expect(
clippy::cast_precision_loss,
... |
rust_dataset_chunk_508913 | rust_dataset.txt | 508,913 | 512 | usually more convenient.
pub fn failure(
&mut self,
name: impl AsRef<str>,
mut mdata: Option<TestMdata>,
attempted_iters: Option<NonZero<usize>>,
kind: FailKind,
) {
if let Some(ref mut mdata) = mdata {
mdata.iterations = attempted_iters;
}
... |
rust_dataset_chunk_508914 | rust_dataset.txt | 508,914 | 512 | (name, md, tm)| (pref.clone() + &name, md, tm)),
)
.collect();
}
/// Evaluates the performance of `self` against `baseline`. The latter is taken
/// as the comparison point, i.e. a positive resulting `PerfReport` means that
/// `self` performed better.
///
/// # Panics
... |
rust_dataset_chunk_508915 | rust_dataset.txt | 508,915 | 512 | max, mean, min }))
}
})
.collect();
PerfReport { deltas }
}
/// Collapses the `PerfReport` into a `HashMap` over `Importance`, with
/// each importance category having its tests contained.
fn collapse(self) -> HashMap<Importance, CategoryInfo> {
... |
rust_dataset_chunk_508916 | rust_dataset.txt | 508,916 | 512 | mean < consts::NOISE_CUTOFF.as_secs_f64() * 1000. / 8. {
format!("{mean:.2} (unreliable)")
} else {
format!("{mean:.2}")
}
},
t... |
rust_dataset_chunk_508917 | rust_dataset.txt | 508,917 | 512 | &str = "↑";
const SIGN_NEG: &str = "↓";
const SIGN_NEUTRAL_POS: &str = "±↑";
const SIGN_NEUTRAL_NEG: &str = "±↓";
let prettify = |time: f64| {
let sign = if time > 0.05 {
SIGN_POS
} else if time > 0. {
... |
rust_dataset_chunk_508918 | rust_dataset.txt | 508,918 | 512 | Similarly, to skip outputting progress to the command line, pass `-- --quiet`.
//! These flags can be combined.
//!
//! ## Comparing runs
//! Passing `--json=ident` will save per-crate run files in `.perf-runs`, e.g.
//! `cargo perf-test -p gpui -- --json=blah` will result in `.perf-runs/blah.gpui.json`
//! being crea... |
rust_dataset_chunk_508919 | rust_dataset.txt | 508,919 | 512 | $name:expr, $mdata:expr, $count:expr, $kind:expr) => {{
$output.failure($name, Some($mdata), Some($count), $kind);
continue;
}};
}
/// How does this perf run return its output?
enum OutputKind<'a> {
/// Print markdown to the terminal.
Markdown,
/// Save JSON to a file.
Json(&'a Pat... |
rust_dataset_chunk_508920 | rust_dataset.txt | 508,920 | 512 | Mdata`.
fn parse_mdata(t_bin: &str, mdata_fn: &str) -> Result<TestMdata, FailKind> {
let mut cmd = Command::new(t_bin);
cmd.args([mdata_fn, "--exact", "--nocapture"]);
let out = cmd
.output()
.expect("FATAL: Could not run test binary {t_bin}");
assert!(out.status.success());
let stdo... |
rust_dataset_chunk_508921 | rust_dataset.txt | 508,921 | 512 | => unreachable!(),
}
}
Ok(TestMdata {
version: version.ok_or(FailKind::BadMetadata)?,
// Iterations may be determined by us and thus left unspecified.
iterations,
// In principle this should always be set, but just for the sake of
// stability allow the potentia... |
rust_dataset_chunk_508922 | rust_dataset.txt | 508,922 | 512 | = Vec::new();
let _ = OpenOptions::new()
.read(true)
.open(entry.path())
.unwrap()
.read_to_end(&mut buffer)
.unwrap();
let o_other: Output = serde_json::from_slice(&buffer).unwrap();
... |
rust_dataset_chunk_508923 | rust_dataset.txt | 508,923 | 512 | // Final byte of t_name is ":", which we need to ignore.
[t_name, kind] => (kind == "test").then(|| &t_name[..t_name.len() - 1]),
_ => None,
}
})
// Exclude tests that aren't marked for perf triage based on suffix.
.filter(|t_name| {
... |
rust_dataset_chunk_508924 | rust_dataset.txt | 508,924 | 512 | execution time exceeds
/// `thresh`, calling `step(iterations)` after every failed run to determine the new
/// iteration count. Returns `None` if the test errored or `step` returned `None`,
/// else `Some(iterations)`.
///
/// # Panics
/// This will panic if `step(usize)` is not monotonically increasing, or if the te... |
rust_dataset_chunk_508925 | rust_dataset.txt | 508,925 | 512 | .args([
"--style",
"none",
"--warmup",
"1",
"--export-markdown",
"-",
// Parse json instead...
"--time-unit",
"millisecond",
&format!("{t_bin} --exact {t_name}"),
]);
perf_cmd.env(consts::ITER_ENV_VAR, format!("{iterations}"));
... |
rust_dataset_chunk_508926 | rust_dataset.txt | 508,926 | 512 | ET.store(true, Ordering::Relaxed),
s if s.starts_with("--json") => {
out_kind = OutputKind::Json(Path::new(
s.strip_prefix("--json=")
.expect("FATAL: Invalid json parameter; pass --json=ident"),
));
}
_ => ()... |
rust_dataset_chunk_508927 | rust_dataset.txt | 508,927 | 512 | _name_pretty, t_mdata, FailKind::Triage);
};
// Now profile!
if let Some(timings) = hyp_profile(t_bin, t_name, final_iter_count) {
output.success(t_name_pretty, t_mdata, final_iter_count, timings);
} else {
fail!(
output,
t_name_pr... |
rust_dataset_chunk_508928 | rust_dataset.txt | 508,928 | 512 | ::workflow_checks::WorkflowValidationArgs),
}
fn main() -> Result<()> {
let args = Args::parse();
match args.command {
CliCommand::Clippy(args) => tasks::clippy::run_clippy(args),
CliCommand::Compliance(args) => tasks::compliance::check_compliance(args),
CliCommand::Licenses(args) => t... |
rust_dataset_chunk_508929 | rust_dataset.txt | 508,929 | 512 | ");
if args.fix {
clippy_command.arg("--fix");
}
clippy_command.arg("--");
// Deny all warnings.
clippy_command.args(["--deny", "warnings"]);
eprintln!(
"running: {cargo} {}",
clippy_command
.get_args()
.map(|arg| arg.to_str().unwrap())
... |
rust_dataset_chunk_508930 | rust_dataset.txt | 508,930 | 512 |
}
fn version_head(&self) -> String {
self.branch
.clone()
.unwrap_or_else(|| self.version_tag().to_string())
}
}
async fn check_compliance_impl(args: ComplianceArgs) -> Result<()> {
let app_id = std::env::var("GITHUB_APP_ID").context("Missing GITHUB_APP_ID")?;
let ... |
rust_dataset_chunk_508931 | rust_dataset.txt | 508,931 | 512 | ().to_string()
);
let summary = report.summary();
println!(
"Applying compliance labels to {} pull requests",
summary.prs_with_errors()
);
let all_errors_known = report.errors().all(|error| {
error.is_unknown_error() && IGNORE_LIST.contains(&error.commit.sha().as_str())
... |
rust_dataset_chunk_508932 | rust_dataset.txt | 508,932 | 512 | Source,
},
};
use url::Url;
pub fn load_workspace_graph() -> Result<PackageGraph> {
MetadataCommand::new()
.build_graph()
.context("failed to load the workspace crate graph")
}
pub fn is_gpui_root(package: PackageMetadata<'_>) -> bool {
package.in_workspace() && package.name().starts_with(... |
rust_dataset_chunk_508933 | rust_dataset.txt | 508,933 | 512 | _some_and(|mut segments| {
segments
.next()
.is_some_and(|owner| owner.eq_ignore_ascii_case("zed-industries"))
&& segments.next().is_some_and(|name| !name.is_empty())
})
})
}
#[cfg(test)]
mod tests {
use serde_json::{Value,... |
rust_dataset_chunk_508934 | rust_dataset.txt | 508,934 | 512 | target: All,
},
FixtureDependency {
to: "upstream",
kind: Normal(Required),
target: All,
},
],
},
FixturePackage {
name: "gpui_plat... |
rust_dataset_chunk_508935 | rust_dataset.txt | 508,935 | 512 | (DependencyDirection::Reverse)
.map(|package| package.name())
.collect::<Vec<_>>();
assert_eq!(
names
.iter()
.copied()
.collect::<std::collections::BTreeSet<_>>(),
[
"gpui",
"gpui_pla... |
rust_dataset_chunk_508936 | rust_dataset.txt | 508,936 | 512 | registry", "missing"] {
assert!(explain_crate(&graph, excluded).is_err(), "{excluded}");
}
use super::super::publish_plan::{Repository, build_publish_plan};
let plan = build_publish_plan(&graph)?;
assert_eq!(
plan.iter()
.map(|entry| entry.packag... |
rust_dataset_chunk_508937 | rust_dataset.txt | 508,937 | 512 | for source in [
PackageSource::CRATES_IO_REGISTRY,
"sparse+https://index.crates.io/",
"git+https://github.com/other/fork#abc",
"git+https://github.com/zed-industries-other/fork#abc",
"git+https://github.com.example.org/zed-industries/fork#abc",
... |
rust_dataset_chunk_508938 | rust_dataset.txt | 508,938 | 512 | "deps": resolved.values().collect::<Vec<_>>(), "features": [],
}));
metadata.push(json!({
"name": name, "version": "0.1.0", "id": name, "source": source,
"dependencies": dependencies, "features": {},
"targets": [{
"name": name,... |
rust_dataset_chunk_508939 | rust_dataset.txt | 508,939 | 512 | unwrap_or(repo);
ensure!(
!owner.is_empty() && !repo.is_empty() && !repo.contains('/'),
"expected an owner/repo path, got {repository}"
);
let revision = revision
.parse::<GitSha>()
.map_err(anyhow::Error::msg)
.with_context(|| format!(... |
rust_dataset_chunk_508940 | rust_dataset.txt | 508,940 | 512 | ,
}
pub struct PublishPlanEntry<'graph> {
pub package: PackageMetadata<'graph>,
pub repository: Repository,
}
pub fn build_publish_plan(graph: &PackageGraph) -> Result<Vec<PublishPlanEntry<'_>>> {
let packages = super::crate_graph::gpui_crates(graph)?;
packages
.packages(DependencyDirection::R... |
rust_dataset_chunk_508941 | rust_dataset.txt | 508,941 | 512 | "gpui_gpui-macros"),
("scheduler", "gpui_scheduler"),
] {
let package = repository.publish_info(original);
assert_eq!(package.original_name, original);
assert_eq!(
package.repository.target_name(package.original_name),
target
... |
rust_dataset_chunk_508942 | rust_dataset.txt | 508,942 | 512 | _string(),
format!("zed-industries/fork@{REVISION}")
);
let Repository::Git(repository) = package.repository else {
bail!("expected a Git repository");
};
assert_eq!(repository.owner, "zed-industries");
assert_eq!(repository.rep... |
rust_dataset_chunk_508943 | rust_dataset.txt | 508,943 | 512 | confirmation before each publish
#[arg(long)]
dry_run: bool,
/// Skip to a specific package (by package name or crate name) and start from there
#[arg(long)]
skip_to: Option<String>,
}
pub fn run_gpui(command: GpuiCommand) -> Result<()> {
let graph = crate_graph::load_workspace_graph()?;
... |
rust_dataset_chunk_508944 | rust_dataset.txt | 508,944 | 512 | _gpui(&version, args.dry_run)?;
println!("GPUI published in {}s", start_time.elapsed().as_secs_f32());
Ok(())
}
fn read_gpui_version() -> Result<String> {
let gpui_cargo_toml_path = "crates/gpui/Cargo.toml";
let contents = std::fs::read_to_string(gpui_cargo_toml_path)
.context("Failed to read c... |
rust_dataset_chunk_508945 | rust_dataset.txt | 508,945 | 512 | continue;
}
}
println!(
"Publishing dependency: {} (package: {})",
crate_name, package_name
);
update_crate_cargo_toml(package_name, crate_name, package_dir, new_version)?;
update_workspace_dependency_version(package_name, crate_name, new_ve... |
rust_dataset_chunk_508946 | rust_dataset.txt | 508,946 | 512 | std::env::var("CARGO").unwrap_or_else(|_| "cargo".to_string());
let mut command = Command::new(&cargo);
command
.arg("publish")
.arg("--allow-dirty")
.args(["-p", crate_name]);
if dry_run {
command.arg("--dry-run");
}
run_comman... |
rust_dataset_chunk_508947 | rust_dataset.txt | 508,947 | 512 | }
Ok(())
}
fn update_profile_override_in_doc(
doc: &mut toml_edit::DocumentMut,
package_name: &str,
crate_name: &str,
) -> Result<()> {
if let Some(profile_dev_package) = doc
.get_mut("profile")
.and_then(|p| p.get_mut("dev"))
.and_then(|d| d.get_mut("package"))
.a... |
rust_dataset_chunk_508948 | rust_dataset.txt | 508,948 | 512 | map(|arg| arg.to_string_lossy())
.collect::<Vec<_>>()
.join(" ");
if args.is_empty() {
program.to_string()
} else {
format!("{} {}", program, args)
}
};
eprintln!("+ {}", command_str);
let output = command
.spawn()
.co... |
rust_dataset_chunk_508949 | rust_dataset.txt | 508,949 | 512 | ", "gpui_collections", "0.2.0")
.unwrap();
let result = doc.to_string();
let output = indoc! {r#"
[workspace]
resolver = "2"
[workspace.dependencies]
# here's a comment
collections = { path = "crates/collections" , version = "0.2... |
rust_dataset_chunk_508950 | rust_dataset.txt | 508,950 | 512 | taffy = { opt-level = 3 }
refineable = { codegen-units = 256 }
util = { codegen-units = 256 }
gpui_collections = { codegen-units = 256 }
"#};
assert_eq!(result, output);
}
}
--- FILE: zed/tooling/xtask/src/tasks/gpui/validation/apache_licensed.rs --... |
rust_dataset_chunk_508951 | rust_dataset.txt | 508,951 | 512 | ,
) -> Option<LicenseViolation> {
let crate_name = crate_name.to_owned();
match license {
Some(APACHE_LICENSE) => {}
Some(license) => {
return Some(LicenseViolation::WrongLicense {
crate_name,
license: license.to_owned(),
});
}
... |
rust_dataset_chunk_508952 | rust_dataset.txt | 508,952 | 512 | &linked),
Some(LicenseViolation::MissingLicense { .. })
));
for (name, license_link) in [
("missing", None),
("broken", Some("../nowhere")),
("mismatched", Some("../LICENSE-GPL")),
] {
let directory = crate_directory(name, license_lin... |
rust_dataset_chunk_508953 | rust_dataset.txt | 508,953 | 512 | PlanEntry<'_>]) -> Result<(), ValidationError> {
validate_with(RULES, plan)
}
fn validate_with(
rules: &[&dyn Rule],
plan: &[PublishPlanEntry<'_>],
) -> Result<(), ValidationError> {
let violations = rules
.iter()
.flat_map(|rule| {
rule.check(plan)
.into_ite... |
rust_dataset_chunk_508954 | rust_dataset.txt | 508,954 | 512 | /xtask/src/tasks/gpui/validation/unique_publish_names.rs ---
use std::collections::BTreeMap;
use thiserror::Error;
use super::{Rule, Violation};
use crate::tasks::gpui::publish_plan::PublishPlanEntry;
pub struct UniquePublishNames;
impl Rule for UniquePublishNames {
fn name(&self) -> &'static str {
"pub... |
rust_dataset_chunk_508955 | rust_dataset.txt | 508,955 | 512 | _util` and `util` would both be published as `gpui_util`"]
);
assert!(
duplicate_publish_names([
("gpui_util".to_owned(), "util"),
("gpui_collections".to_owned(), "collections"),
])
.is_empty()
);
}
}
--- FILE: zed/toolin... |
rust_dataset_chunk_508956 | rust_dataset.txt | 508,956 | 512 | _with("extensions"));
let cargo_toml = read_cargo_toml(&package.manifest_path)?;
let is_using_workspace_lints = cargo_toml.lints.is_some_and(|lints| lints.workspace);
if !is_using_workspace_lints {
eprintln!(
"{package:?} is not using workspace lints",
... |
rust_dataset_chunk_508957 | rust_dataset.txt | 508,957 | 512 | utable end-to-end harness (an example, never a cargo test target) as
/// an unprivileged user, requiring successful sandbox setup on the working host
/// and fail-closed execution when user namespaces are disabled.
/// They require Linux with `/dev/kvm` available, and `nix` with flakes enabled.
/// Nothing in CI runs t... |
rust_dataset_chunk_508958 | rust_dataset.txt | 508,958 | 512 | tests: {}", selected.join(", "));
let status = command.status().context("failed to run `nix build`")?;
if !status.success() {
bail!("sandbox tests failed");
}
Ok(())
}
/// The Nix system double for the host. These tests are Linux-only, so we always
/// target a `*-linux` system (overridable vi... |
rust_dataset_chunk_508959 | rust_dataset.txt | 508,959 | 512 | pub struct SetupWebrtcArgs {
/// Re-download even if the target directory already exists.
#[arg(long)]
force: bool,
/// Override the host triple component used for the release artifact
/// (e.g. `mac-arm64-release`). Defaults to the current host.
#[arg(long)]
triple: Option<String>,
//... |
rust_dataset_chunk_508960 | rust_dataset.txt | 508,960 | 512 | Ok(())
}
fn read_webrtc_sys_rev(workspace_root: &Path) -> Result<String> {
let manifest_path = workspace_root.join("Cargo.toml");
let manifest = Manifest::from_path(&manifest_path)
.with_context(|| format!("parsing {}", manifest_path.display()))?;
let patch = manifest
.patch
.get(... |
rust_dataset_chunk_508961 | rust_dataset.txt | 508,961 | 512 | into: &Path) -> Result<()> {
let url = format!(
"https://github.com/zed-industries/livekit-rust-sdks/releases/download/{tag}/webrtc-{triple}.zip"
);
let zip_path = into.join(format!("webrtc-{triple}.zip"));
eprintln!("Downloading {url}");
let status = Command::new("curl")
.args(["-... |
rust_dataset_chunk_508962 | rust_dataset.txt | 508,962 | 512 | , updated).with_context(|| format!("writing {}", path.display()))?;
eprintln!("Added {GITIGNORE_ENTRY} to .gitignore");
Ok(())
}
fn update_cargo_config(webrtc_path: &Path) -> Result<()> {
let home = std::env::var_os("HOME")
.or_else(|| std::env::var_os("USERPROFILE"))
.context("could not de... |
rust_dataset_chunk_508963 | rust_dataset.txt | 508,963 | 512 | #[arg(long)]
pub release: bool,
#[arg(long, default_value = "8080")]
pub port: u16,
#[arg(long)]
pub no_serve: bool,
}
fn check_program(binary: &str, install_hint: &str) -> Result<()> {
match Command::new(binary).arg("--version").output() {
Ok(output) if output.status.success() => Ok((... |
rust_dataset_chunk_508964 | rust_dataset.txt | 508,964 | 512 | {
cmd.arg("--release");
}
let _ = cmd.status().context("failed to run cargo build")?;
// Run wasm-bindgen on each .wasm that was produced.
let mut succeeded: Vec<String> = Vec::new();
let mut failed: Vec<String> = Vec::new();
for name in &examples {
let wasm_path = format!("t... |
rust_dataset_chunk_508965 | rust_dataset.txt | 508,965 | 512 | _serve {
return Ok(());
}
// Serve with COEP/COOP headers required for WebGPU / SharedArrayBuffer.
eprintln!("Serving on http://127.0.0.1:{}...", args.port);
let server_script = format!(
r#"
import http.server
class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, ... |
rust_dataset_chunk_508966 | rust_dataset.txt | 508,966 | 512 | from './{name}.js';
await init();
document.getElementById('loading').classList.add('hidden');
</script>
</body>
</html>
"#
)
}
fn make_gallery_html(examples: &[&str]) -> String {
let mut buttons = String::new();
for name in examples {
buttons.push_str(&format!(
" ... |
rust_dataset_chunk_508967 | rust_dataset.txt | 508,967 | 512 | 0.85rem; text-align: left;
cursor: pointer;
font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}}
.example-btn:hover {{ background: #313244; color: #cdd6f4; }}
.example-btn.active {{ background: #45475a; color: #f5e0dc; font-weight: 600; }}
#main {{... |
rust_dataset_chunk_508968 | rust_dataset.txt | 508,968 | 512 | const buttons = document.querySelectorAll('.example-btn');
const viewer = document.getElementById('viewer');
const nameEl = document.getElementById('current-name');
const openEl = document.getElementById('open-tab');
function select(name) {{
buttons.forEach(b => b... |
rust_dataset_chunk_508969 | rust_dataset.txt | 508,969 | 512 | > {
let (title, span, label) = match self {
PermissionsError::Missing => (
"Workflow is missing a top-level `permissions:` key",
first_line_span(raw_content, "name:"),
"Add a top-level `permissions:` key so this workflow defaults to the least privilege... |
rust_dataset_chunk_508970 | rust_dataset.txt | 508,970 | 512 | .iter()
.map(|(line, pattern_range)| {
let initial_offset = identical_lines
.get(&(line.as_str(), pattern_range.start))
.copied()
.unwrap_or_default();
let line_start = raw_content[initial_offset..]
... |
rust_dataset_chunk_508971 | rust_dataset.txt | 508,971 | 512 | ParseError(error) => Either::Left(error),
WorkflowError::ValidationError(error) => Either::Right(error),
});
if !parsing_errors.is_empty() {
Err(anyhow!(
"Failed to read or parse some workflow files: {}",
parsing_errors.into_iter().join("\n")
))
} els... |
rust_dataset_chunk_508972 | rust_dataset.txt | 508,972 | 512 | Iterator<Item = PathBuf> {
WorkflowType::iter()
.map(|workflow_type| workflow_type.folder_path())
.flat_map(|folder_path| {
fs::read_dir(folder_path).into_iter().flat_map(|entries| {
entries
.flat_map(Result::ok)
.map(|entry| entry... |
rust_dataset_chunk_508973 | rust_dataset.txt | 508,973 | 512 | ::deploy_docs_workflow_call,
release::{self, notify_on_failure},
runners::{self, Arch},
steps::{
CommonJobConditions, CommonPermissionSets, FluentBuilder, NamedJob, checkout_repo,
dependant_job, named,
},
vars::{self, StepOutput, WorkflowInput},
};
const TAG_NAME_ENV: &str = "${{ gi... |
rust_dataset_chunk_508974 | rust_dataset.txt | 508,974 | 512 | WorkflowDispatch::default()
.add_input(tag_name.name, tag_name.input())
.add_input(prerelease.name, prerelease.input())
.add_input(body.name, body.input()),
))
.add_job(refresh_zed_dev.name, refresh_zed_dev.job)
.add_job(deploy_doc... |
rust_dataset_chunk_508975 | rust_dataset.txt | 508,975 | 512 | 93c8fb0757", // v1.4.1
)
.id("get-content")
.add_with((
"stringToTruncate",
format!(
"📣 Zed [{TAG_NAME}](<${{{{ steps.get-release-url.outputs.URL }}}}>) was just released!\n\n{RELEASE_BODY}\n"
),
))
.add_with(("maxLength", 200... |
rust_dataset_chunk_508976 | rust_dataset.txt | 508,976 | 512 | fn set_package_name() -> (Step<Run>, StepOutput) {
let script = r#"if ($env:IS_PRERELEASE -eq "true") {
$PACKAGE_NAME = "ZedIndustries.Zed.Preview"
} else {
$PACKAGE_NAME = "ZedIndustries.Zed"
}
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $env:GITHUB_OUTPUT
"#;
let step = named::pwsh(script).id("set-... |
rust_dataset_chunk_508977 | rust_dataset.txt | 508,977 | 512 | named::job(job)
}
--- FILE: zed/tooling/xtask/src/tasks/workflows/autofix_pr.rs ---
use gh_workflow::*;
use crate::tasks::workflows::{
runners,
steps::{
self, CommonPermissionSets, DownloadArtifactStep, FluentBuilder, IfNoFilesFound, NamedJob,
RepositoryTarget, TokenPermissions, UploadArt... |
rust_dataset_chunk_508978 | rust_dataset.txt | 508,978 | 512 | Expression::new(format!(
"{expr} == true || {expr} == 'true'",
expr = run_clippy.expr()
))
}
fn checkout_pr(pr_number: &WorkflowInput) -> Step<Run> {
named::bash(r#"gh pr checkout "$PR_NUMBER""#)
.add_env(("PR_NUMBER", pr_number.to_string()))
.ad... |
rust_dataset_chunk_508979 | rust_dataset.txt | 508,979 | 512 | _dependencies)
.add_step(steps::setup_pnpm())
.add_step(install_cargo_shear().if_condition(clippy_enabled(run_clippy)))
.add_step(run_cargo_fix().if_condition(clippy_enabled(run_clippy)))
.add_step(run_cargo_shear_fix().if_condition(clippy_enabled(run_clippy)))
... |
rust_dataset_chunk_508980 | rust_dataset.txt | 508,980 | 512 | /tooling/xtask/src/tasks/workflows/bump_patch_version.rs ---
use gh_workflow::*;
use crate::tasks::workflows::{
runners,
steps::{self, CheckoutStep, CommonJobConditions, CommonPermissionSets, named},
vars::{StepOutput, WorkflowInput},
};
pub fn bump_patch_version() -> Workflow {
let branch = WorkflowI... |
rust_dataset_chunk_508981 | rust_dataset.txt | 508,981 | 512 | Permissions::Contents, Level::Write),
(steps::TokenPermissions::Workflows, Level::Write),
])
.into();
let channel_step = read_channel();
let tag_suffix = StepOutput::new(&channel_step, "tag_suffix");
let bump_version_step = bump_version();
let version = StepOutput::new(&bump_... |
rust_dataset_chunk_508982 | rust_dataset.txt | 508,982 | 512 | bump_main_job.job)
.add_job(preview_job.name, preview_job.job)
.add_job(stable_job.name, stable_job.job)
}
struct ResolvedOutputs {
next_version: vars::JobOutput,
pr_branch: vars::JobOutput,
preview_branch: vars::JobOutput,
preview_tag: vars::JobOutput,
stable_branch: vars::JobOutp... |
rust_dataset_chunk_508983 | rust_dataset.txt | 508,983 | 512 | "
echo "pr_branch=$pr_branch"
echo "preview_branch=$preview_branch"
echo "preview_tag=$preview_tag"
echo "stable_branch=$stable_branch"
} >> "$GITHUB_OUTPUT"
echo "Resolved: next=$next_version preview=$preview_branch($preview_tag) ... |
rust_dataset_chunk_508984 | rust_dataset.txt | 508,984 | 512 | minor")
}
let (authenticate, token) = steps::authenticate_as_zippy()
.for_repository(steps::RepositoryTarget::current())
.with_permissions([
(steps::TokenPermissions::Contents, Level::Write),
(steps::TokenPermissions::Issues, Level::Write),
(steps::TokenPerm... |
rust_dataset_chunk_508985 | rust_dataset.txt | 508,985 | 512 | ("crates/zed/RELEASE_CHANNEL")
.into();
let commit_sha = StepOutput::new_unchecked(&commit_step, "commit");
named::job(
Job::default()
.cond(Expression::new(format!(
"{} == 'all' || {} == 'preview'",
target.expr(),
target.expr(),
... |
rust_dataset_chunk_508986 | rust_dataset.txt | 508,986 | 512 | named::job(
Job::default()
.cond(Expression::new(format!(
"{} == 'all' || {} == 'stable'",
target.expr(),
target.expr(),
)))
.permissions(Permissions::default().contents(Level::Write))
.needs(vec![versions_job.na... |
rust_dataset_chunk_508987 | rust_dataset.txt | 508,987 | 512 | BRANCH" "$COMMIT" "$CHANNEL""#)
.add_env(("BRANCH", branch.to_string()))
.add_env(("COMMIT", commit.to_string()))
.add_env(("CHANNEL", channel.to_string()))
.with_zippy_git_identity()
.add_env(("GITHUB_TOKEN", token))
}
let (authenticate, token) = ste... |
rust_dataset_chunk_508988 | rust_dataset.txt | 508,988 | 512 | tag_output = StepOutput::new(&determine_version_step, "tag");
let job = Job::default()
.with_repository_owner_guard()
.runs_on(runners::LINUX_SMALL)
.add_step(steps::checkout_repo().with_full_history())
.add_step(steps::cache_rust_dependencies_namespace())
.add_step(determi... |
rust_dataset_chunk_508989 | rust_dataset.txt | 508,989 | 512 | ::setup_node()
.add_with(("cache", "pnpm"))
.add_with(("cache-dependency-path", "script/danger/pnpm-lock.yaml")),
)
.add_step(install_deps())
.add_step(run()),
}
}
--- FILE: zed/tooling/xtask/src/tasks/workflows/deploy_collab.rs ---
use g... |
rust_dataset_chunk_508990 | rust_dataset.txt | 508,990 | 512 | ("Run tests")
.runs_on(runners::LINUX_XL)
.add_service(
"postgres",
Container::new("postgres:15@sha256:1b92e7a80c021647bf70f5d3eb66066a998e4f5cf43c07bb9dc9f729782cf88e")
.add_env(("POSTGRES_HOST_AUTH_METHOD", "trust"))
.port... |
rust_dataset_chunk_508991 | rust_dataset.txt | 508,991 | 512 | }
named::job(
dependant_job(deps)
.name("Publish collab server image")
.runs_on(runners::LINUX_XL)
.add_step(install_doctl())
.add_step(sign_into_registry())
.add_step(steps::checkout_repo())
.add_step(build_docker_image())
... |
rust_dataset_chunk_508992 | rust_dataset.txt | 508,992 | 512 | ED_SERVICE_NAME=collab
export ZED_LOAD_BALANCER_SIZE_UNIT=$ZED_COLLAB_LOAD_BALANCER_SIZE_UNIT
export DATABASE_MAX_CONNECTIONS=850
envsubst < crates/collab/k8s/collab.template.yml | kubectl apply -f -
kubectl -n "$ZED_KUBE_NAMESPACE" rollout status "deployment/$ZED_SERVICE... |
rust_dataset_chunk_508993 | rust_dataset.txt | 508,993 | 512 | Self::Nightly => "docs-nightly",
Self::Preview => "docs-preview",
Self::Stable => "docs",
}
}
pub(crate) fn channel_name(&self) -> &'static str {
match self {
Self::Nightly => "nightly",
Self::Preview => "preview",
Self::St... |
rust_dataset_chunk_508994 | rust_dataset.txt | 508,994 | 512 | |step, checkout_ref| {
step.with_ref(checkout_ref)
}),
)
.runs_on(runners::LINUX_XL)
.add_step(steps::setup_cargo_config(runners::Platform::Linux))
.add_step(steps::cache_rust_dependencies_namespace())
.map(steps::install_l... |
rust_dataset_chunk_508995 | rust_dataset.txt | 508,995 | 512 | accountId", vars::CLOUDFLARE_ACCOUNT_ID))
.add_with(("command", "deploy .cloudflare/docs-proxy/src/worker.js"))
}
fn upload_wrangler_logs() -> UploadArtifactStep {
steps::upload_artifact("wrangler_logs", "/home/runner/.config/.wrangler/logs/")
.if_condition(Expression::new("always()... |
rust_dataset_chunk_508996 | rust_dataset.txt | 508,996 | 512 | preview_project_name = DocsChannel::Preview.project_name(),
stable_project_name = DocsChannel::Stable.project_name(),
))
.id("resolve-channel")
.add_env(("CHANNEL", channel_expr.into()));
let channel = StepOutput::new(&step, "channel");
let site_url = StepOutput::new(&step, "site_url");
... |
rust_dataset_chunk_508997 | rust_dataset.txt | 508,997 | 512 | vars::CLOUDFLARE_API_TOKEN.to_owned(),
),
(
"CLOUDFLARE_ACCOUNT_ID".to_owned(),
vars::CLOUDFLARE_ACCOUNT_ID.to_owned(),
),
]));
NamedJob {
name: "deploy_docs".to_owned(),
job,
}
}
pub(crate) fn deploy_docs_job(
ch... |
rust_dataset_chunk_508998 | rust_dataset.txt | 508,998 | 512 | )
.add_job(deploy_docs.name, deploy_docs.job)
}
pub(crate) fn deploy_nightly_docs() -> Workflow {
let deploy_docs = deploy_docs_workflow_call("nightly", "${{ github.sha }}");
named::workflow()
.name("deploy_nightly_docs")
.permissions(Permissions::default())
.add_event(... |
rust_dataset_chunk_508999 | rust_dataset.txt | 508,999 | 512 |
if git show HEAD~1:"$ext/extension.toml" >/dev/null 2>&1; then
FILTERED=$(echo "$FILTERED" | jq -c --arg e "$ext" '. + [$e]')
fi
done
echo "changed_extensions=$FILTERED" >> "$GITHUB_OUTPUT"
"#};
let script = format!(
"{preamble}{detect}{filter}",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.