tidy: delete a bunch of dead code

Found ... by edef's harness. There was more dead code it found, which I
didn't address because it felt less obviously deletable:

- `AutoDestroyCgroup::path()` / `::delegation()`
- `TeeSource`, `LambdaSink`
- `S3BinaryCacheStore::getS3Stats()` (maybe Hydra? idk)
- `fetchers::getBoolAttr()` (technically deletable but it would be
  inconsistent with the others)

Change-Id: I913d2afd61e24136fb506389fc33a1016a6a6964
This commit is contained in:
Jade Lovelace
2026-07-14 20:17:11 +00:00
committed by jade
parent e6ddca402b
commit f51148a75b
12 changed files with 12 additions and 99 deletions
-20
View File
@@ -67,16 +67,6 @@ FlakeRef parseFlakeRef(
return flakeRef;
}
std::optional<FlakeRef> maybeParseFlakeRef(
const std::string & url, const std::optional<Path> & baseDir)
{
try {
return parseFlakeRef(url, baseDir);
} catch (Error &) {
return {};
}
}
std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
const std::string & url,
const std::optional<Path> & baseDir,
@@ -234,16 +224,6 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
}
}
std::optional<std::pair<FlakeRef, std::string>> maybeParseFlakeRefWithFragment(
const std::string & url, const std::optional<Path> & baseDir)
{
try {
return parseFlakeRefWithFragment(url, baseDir);
} catch (Error & e) {
return {};
}
}
FlakeRef FlakeRef::fromAttrs(const fetchers::Attrs & attrs)
{
auto attrs2(attrs);
-6
View File
@@ -70,18 +70,12 @@ FlakeRef parseFlakeRef(
bool allowMissing = false,
bool isFlake = true);
std::optional<FlakeRef> maybeParseFlake(
const std::string & url, const std::optional<Path> & baseDir = {});
std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
const std::string & url,
const std::optional<Path> & baseDir = {},
bool allowMissing = false,
bool isFlake = true);
std::optional<std::pair<FlakeRef, std::string>> maybeParseFlakeRefWithFragment(
const std::string & url, const std::optional<Path> & baseDir = {});
std::tuple<FlakeRef, std::string, ExtendedOutputsSpec> parseFlakeRefWithFragmentAndExtendedOutputsSpec(
const std::string & url,
const std::optional<Path> & baseDir = {},
-18
View File
@@ -99,13 +99,6 @@ JSON ExprVar::toJSON(const SymbolTable & symbols) const
return {{"_type", "ExprVar"}, {"value", stringToJSON(symbols[name])}};
}
JSON ExprInheritFrom::toJSON(SymbolTable const & symbols) const
{
return {
{"_type", "ExprInheritFrom"}
};
}
JSON ExprSelect::toJSON(const SymbolTable & symbols) const
{
JSON out = {
@@ -747,17 +740,6 @@ void ExprLambda::setName(Symbol name)
body->setName(name);
}
std::string ExprLambda::showNamePos(const EvalState & state) const
{
std::string id(name
? concatStrings("'", state.ctx.symbols[name], "'")
: "anonymous function");
return fmt("%1% at %2%", id, state.ctx.positions[pos]);
}
/* Position table. */
Pos PosTable::operator[](PosIdx p) const
+11 -3
View File
@@ -126,7 +126,7 @@ public:
std::unique_ptr<Expr> parsed, Evaluator & es, const std::shared_ptr<const StaticEnv> & env
);
virtual JSON toJSON(const SymbolTable & symbols) const;
virtual JSON toJSON(const SymbolTable & symbols) const = 0;
virtual void accept(ExprVisitor & ev, std::unique_ptr<Expr> & ptr) = 0;
virtual Value eval(EvalState & state, Env & env);
Value makeThunk(Evaluator & ctx, Env & env);
@@ -303,7 +303,11 @@ struct ExprInheritFrom : Expr
{
}
JSON toJSON(const SymbolTable & symbols) const override;
JSON toJSON(const SymbolTable & symbols) const override
{
abort();
}
Value eval(EvalState & state, Env & env) override;
void accept(ExprVisitor & ev, std::unique_ptr<Expr> & ptr) override { ev.visit(*this, ptr); }
};
@@ -518,7 +522,6 @@ struct ExprLambda : Expr
{
}
void setName(Symbol name) override;
std::string showNamePos(const EvalState & state) const;
/** Returns the name of the lambda,
* or "anonymous lambda" if it doesn't have one.
@@ -657,6 +660,11 @@ struct ExprPos : Expr
/* only used to mark thunks as black holes. */
struct ExprBlackHole : Expr
{
JSON toJSON(const SymbolTable & symbols) const override
{
abort();
}
Value eval(EvalState & state, Env & env) override;
void accept(ExprVisitor & ev, std::unique_ptr<Expr> & ptr) override { ev.visit(*this, ptr); }
};
-4
View File
@@ -360,10 +360,6 @@ public:
{
return false;
}
JobCategory jobCategory() const override {
return JobCategory::Build;
};
};
MakeError(NotDeterministic, BuildError);
+1 -24
View File
@@ -27,23 +27,6 @@ typedef std::shared_ptr<Goal> GoalPtr;
*/
typedef std::set<GoalPtr> Goals;
/**
* Used as a hint to the worker on how to schedule a particular goal. For example,
* builds are typically CPU- and memory-bound, while substitutions are I/O bound.
* Using this information, the worker might decide to schedule more or fewer goals
* of each category in parallel.
*/
enum struct JobCategory {
/**
* A build of a derivation; it will use CPU and disk resources.
*/
Build,
/**
* A substitution an arbitrary store object; it will use network resources.
*/
Substitution,
};
struct Goal
{
typedef enum {ecSuccess, ecFailed, ecNoSubstituters, ecIncompleteClosure} ExitCode;
@@ -139,13 +122,7 @@ public:
return name;
}
virtual void cleanup() { }
/**
* @brief Hint for the scheduler, which concurrency limit applies.
* @see JobCategory
*/
virtual JobCategory jobCategory() const = 0;
virtual void cleanup() {}
};
}
-4
View File
@@ -90,10 +90,6 @@ public:
kj::Promise<Result<WorkResult>> referencesValid() noexcept;
kj::Promise<Result<WorkResult>> tryToRun() noexcept;
kj::Promise<Result<WorkResult>> finished() noexcept;
JobCategory jobCategory() const override {
return JobCategory::Substitution;
};
};
}
-6
View File
@@ -744,12 +744,6 @@ WireFormatGenerator serializeDerivation(const Store & store, const BasicDerivati
}
}
void writeDerivation(Sink & out, const Store & store, const BasicDerivation & drv)
{
out << serializeDerivation(store, drv);
}
std::string hashPlaceholder(const OutputNameView outputName)
{
// FIXME: memoize?
-1
View File
@@ -359,7 +359,6 @@ struct Sink;
Source & readDerivation(Source & in, const Store & store, BasicDerivation & drv, std::string_view name);
WireFormatGenerator serializeDerivation(const Store & store, const BasicDerivation & drv);
void writeDerivation(Sink & out, const Store & store, const BasicDerivation & drv);
/**
* This creates an opaque and almost certainly unique string
-5
View File
@@ -161,11 +161,6 @@ ref<FSAccessor> makeNarAccessor(std::string && nar)
return make_ref<NarAccessor>(std::move(nar));
}
ref<FSAccessor> makeNarAccessor(Source & source)
{
return make_ref<NarAccessor>(source);
}
ref<FSAccessor> makeLazyNarAccessor(const std::string & listing,
GetNarBytes getNarBytes)
{
-2
View File
@@ -18,8 +18,6 @@ struct Source;
*/
ref<FSAccessor> makeNarAccessor(std::string && nar);
ref<FSAccessor> makeNarAccessor(Source & source);
/**
* Create a NAR accessor from a NAR listing (in the format produced by
* listNar()). The callback getNarBytes(offset, length) is used by the
-6
View File
@@ -122,11 +122,6 @@ public:
int wait();
void waitAndCheck();
std::optional<int> getStdoutFD() const
{
return childStdout ? std::optional(childStdout->getFD()) : std::nullopt;
}
AsyncFdIoStream * getStdout() const
{
return childStdout.get();
@@ -160,7 +155,6 @@ public:
using RunningProgram::operator bool;
using RunningProgram::getStdout;
using RunningProgram::getStdoutFD;
using RunningProgram::kill;
using RunningProgram::wait;